home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue26 / directx / DIRECTX.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-05-28  |  225.5 KB  |  6,875 lines

  1. {*******************************************************}
  2. { BETA - BETA - BETA - BETA - BETA - BETA - BETA - BETA }
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       DirectX API Interface Unit                      }
  6. {       DirectDraw, DirectPlay,                         }
  7. {       DirectSound and Direct3D                        }
  8. {                                                       }
  9. {       Copyright(c) 1997 Borland International         }
  10. {                                                       }
  11. {*******************************************************}
  12.  
  13. unit DirectX;
  14.  
  15. {$ALIGN ON}
  16. {$MINENUMSIZE 4}
  17. {$WEAKPACKAGEUNIT}
  18.  
  19. interface
  20.  
  21. uses Windows, MMSystem;
  22.  
  23. (*============================================================================
  24.  *
  25.  * DirectDraw Structures
  26.  *
  27.  * Various structures used to invoke DirectDraw.
  28.  *
  29.  *==========================================================================*)
  30.  
  31. const
  32.   DD_ROP_SPACE = (256 div 32);       // space required to store ROP array
  33.  
  34. type
  35.   IDirectDraw = interface;
  36.   IDirectDraw2 = interface;
  37.   IDirectDrawSurface = interface;
  38.   IDirectDrawSurface2 = interface;
  39.   IDirectDrawPalette = interface;
  40.   IDirectDrawClipper = interface;
  41.  
  42.  
  43.   TDDCOLORKEY = record
  44.     dwColorSpaceLowValue: DWORD;   // low boundary of color space that is to
  45.                                     // be treated as Color Key, inclusive
  46.     dwColorSpaceHighValue: DWORD;  // high boundary of color space that is
  47.                                     // to be treated as Color Key, inclusive
  48.   end;
  49.   PDDCOLORKEY = ^TDDCOLORKEY;
  50.  
  51.   TDDSCAPS = record
  52.      dwCaps: DWORD;         // capabilities of surface wanted
  53.   end;
  54.   PDDSCAPS = ^TDDSCAPS;
  55.  
  56.   TDDCAPS = record
  57.     dwSize: DWORD;                 // size of the DDDRIVERCAPS structure
  58.     dwCaps: DWORD;                 // driver specific capabilities
  59.     dwCaps2: DWORD;                // more driver specific capabilites
  60.     dwCKeyCaps: DWORD;             // color key capabilities of the surface
  61.     dwFXCaps: DWORD;               // driver specific stretching and effects capabilites
  62.     dwFXAlphaCaps: DWORD;          // alpha driver specific capabilities
  63.     dwPalCaps: DWORD;              // palette capabilities
  64.     dwSVCaps: DWORD;               // stereo vision capabilities
  65.     dwAlphaBltConstBitDepths: DWORD;       // DDBD_2,4,8
  66.     dwAlphaBltPixelBitDepths: DWORD;       // DDBD_1,2,4,8
  67.     dwAlphaBltSurfaceBitDepths: DWORD;     // DDBD_1,2,4,8
  68.     dwAlphaOverlayConstBitDepths: DWORD;   // DDBD_2,4,8
  69.     dwAlphaOverlayPixelBitDepths: DWORD;   // DDBD_1,2,4,8
  70.     dwAlphaOverlaySurfaceBitDepths: DWORD; // DDBD_1,2,4,8
  71.     dwZBufferBitDepths: DWORD;             // DDBD_8,16,24,32
  72.     dwVidMemTotal: DWORD;          // total amount of video memory
  73.     dwVidMemFree: DWORD;           // amount of free video memory
  74.     dwMaxVisibleOverlays: DWORD;   // maximum number of visible overlays
  75.     dwCurrVisibleOverlays: DWORD;  // current number of visible overlays
  76.     dwNumFourCCCodes: DWORD;       // number of four cc codes
  77.     dwAlignBoundarySrc: DWORD;     // source rectangle alignment
  78.     dwAlignSizeSrc: DWORD;         // source rectangle byte size
  79.     dwAlignBoundaryDest: DWORD;    // dest rectangle alignment
  80.     dwAlignSizeDest: DWORD;        // dest rectangle byte size
  81.     dwAlignStrideAlign: DWORD;     // stride alignment
  82.     dwRops: Array [ 0..DD_ROP_SPACE-1 ] of DWORD;   // ROPS supported
  83.     ddsCaps: TDDSCAPS;                // DDSCAPS structure has all the general capabilities
  84.     dwMinOverlayStretch: DWORD;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  85.     dwMaxOverlayStretch: DWORD;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  86.     dwMinLiveVideoStretch: DWORD;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  87.     dwMaxLiveVideoStretch: DWORD;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  88.     dwMinHwCodecStretch: DWORD;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  89.     dwMaxHwCodecStretch: DWORD;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
  90.     dwReserved1: DWORD;            // reserved
  91.     dwReserved2: DWORD;            // reserved
  92.     dwReserved3: DWORD;            // reserved
  93.     dwSVBCaps: DWORD;              // driver specific capabilities for System->Vmem blts
  94.     dwSVBCKeyCaps: DWORD;          // driver color key capabilities for System->Vmem blts
  95.     dwSVBFXCaps: DWORD;            // driver FX capabilities for System->Vmem blts
  96.     dwSVBRops: Array [ 0..DD_ROP_SPACE-1 ] of DWORD;// ROPS supported for System->Vmem blts
  97.     dwVSBCaps: DWORD;              // driver specific capabilities for Vmem->System blts
  98.     dwVSBCKeyCaps: DWORD;          // driver color key capabilities for Vmem->System blts
  99.     dwVSBFXCaps: DWORD;            // driver FX capabilities for Vmem->System blts
  100.     dwVSBRops: Array [ 0..DD_ROP_SPACE-1 ] of DWORD;// ROPS supported for Vmem->System blts
  101.     dwSSBCaps: DWORD;              // driver specific capabilities for System->System blts
  102.     dwSSBCKeyCaps: DWORD;          // driver color key capabilities for System->System blts
  103.     dwSSBFXCaps: DWORD;            // driver FX capabilities for System->System blts
  104.     dwSSBRops: Array [ 0..DD_ROP_SPACE-1 ] of DWORD;// ROPS supported for System->System blts
  105.     dwReserved4: DWORD;            // reserved
  106.     dwReserved5: DWORD;            // reserved
  107.     dwReserved6: DWORD;            // reserved
  108.   end;
  109.   PDDCAPS = ^TDDCAPS;
  110.  
  111. (*
  112.  * DDPIXELFORMAT
  113.  *)
  114.  
  115.   TDDPIXELFORMAT = record
  116.     dwSize: DWORD;                 // size of structure
  117.     dwFlags: DWORD;                // pixel format flags
  118.     dwFourCC: DWORD;               // (FOURCC code)
  119.     case Integer of
  120.     0: (
  121.       dwRGBBitCount: DWORD;          // how many bits per pixel
  122.       dwRBitMask: DWORD;             // mask for red bit
  123.       dwGBitMask: DWORD;             // mask for green bits
  124.       dwBBitMask: DWORD;             // mask for blue bits
  125.       dwRGBAlphaBitMask: DWORD;      // mask for alpha channel
  126.      );
  127.     1: (
  128.       dwYUVBitCount: DWORD;          // how many bits per pixel
  129.       dwYBitMask: DWORD;             // mask for Y bits
  130.       dwUBitMask: DWORD;             // mask for U bits
  131.       dwVBitMask: DWORD;             // mask for V bits
  132.       dwYUVAlphaBitMask: DWORD;      // mask for alpha channel
  133.      );
  134.     2: (
  135.       dwZBufferBitDepth: DWORD;      // how many bits for z buffers
  136.      );
  137.     3: (
  138.       dwAlphaBitDepth: DWORD;        // how many bits for alpha channels
  139.      );
  140.   end;
  141.   PDDPIXELFORMAT = ^TDDPIXELFORMAT;
  142.  
  143. (*
  144.  * DDBLTFX
  145.  * Used to pass override information to the DIRECTDRAWSURFACE callback Blt.
  146.  *)
  147.  
  148.   TDDBLTFX = record
  149.     dwSize: DWORD;                           // size of structure
  150.     dwDDFX: DWORD;                           // FX operations
  151.     dwROP: DWORD;                            // Win32 raster operations
  152.     dwDDROP: DWORD;                          // Raster operations new for DirectDraw
  153.     dwRotationAngle: DWORD;                  // Rotation angle for blt
  154.     dwZBufferOpCode: DWORD;                  // ZBuffer compares
  155.     dwZBufferLow: DWORD;                     // Low limit of Z buffer
  156.     dwZBufferHigh: DWORD;                    // High limit of Z buffer
  157.     dwZBufferBaseDest: DWORD;                // Destination base value
  158.     dwZDestConstBitDepth: DWORD;             // Bit depth used to specify Z constant for destination
  159.     case Integer of
  160.     0: (
  161.       dwZDestConst: DWORD;                   // Constant to use as Z buffer for dest
  162.       dwZSrcConstBitDepth: DWORD;            // Bit depth used to specify Z constant for source
  163.       dwZSrcConst: DWORD;                    // Constant to use as Z buffer for src
  164.       dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  165.       dwAlphaEdgeBlend: DWORD;               // Alpha for edge blending
  166.       dwReserved: DWORD;
  167.       dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  168.       dwAlphaDestConst: DWORD;               // Constant to use as Alpha Channel
  169.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  170.       dwAlphaSrcConst: DWORD;                // Constant to use as Alpha Channel
  171.       dwFillColor: DWORD;                    // color in RGB or Palettized
  172.       ddckDestColorkey: TDDCOLORKEY;               // DestColorkey override
  173.       ddckSrcColorkey: TDDCOLORKEY;                // SrcColorkey override
  174.      );
  175.     1: (
  176.       lpDDSZBufferDest: IDirectDrawSurface;   // Surface to use as Z buffer for dest
  177.       UNIONFILLER1b: DWORD;
  178.       lpDDSZBufferSrc: IDirectDrawSurface;    // Surface to use as Z buffer for src
  179.       UNIONFILLER1d: DWORD;
  180.       UNIONFILLER1e: DWORD;
  181.       UNIONFILLER1f: DWORD;
  182.       UNIONFILLER1g: DWORD;
  183.       lpDDSAlphaDest: IDirectDrawSurface;     // Surface to use as Alpha Channel
  184.       UNIONFILLER1i: DWORD;
  185.       lpDDSAlphaSrc: IDirectDrawSurface;      // Surface to use as Alpha Channel
  186.       dwFillDepth: DWORD;                    // depth value for z-buffer
  187.      );
  188.     2: (
  189.       UNIONFILLER2a: DWORD;
  190.       UNIONFILLER2b: DWORD;
  191.       UNIONFILLER2c: DWORD;
  192.       UNIONFILLER2d: DWORD;
  193.       UNIONFILLER2e: DWORD;
  194.       UNIONFILLER2f: DWORD;
  195.       UNIONFILLER2g: DWORD;
  196.       UNIONFILLER2h: DWORD;
  197.       UNIONFILLER2i: DWORD;
  198.       UNIONFILLER2j: DWORD;
  199.       lpDDSPattern: IDirectDrawSurface;       // Surface to use as pattern
  200.      );
  201.   end;
  202.   PDDBLTFX = ^TDDBLTFX;
  203.  
  204.   TDDOVERLAYFX = record
  205.     dwSize: DWORD;                         // size of structure
  206.     dwAlphaEdgeBlendBitDepth: DWORD;       // Bit depth used to specify constant for alpha edge blend
  207.     dwAlphaEdgeBlend: DWORD;               // Constant to use as alpha for edge blend
  208.     dwReserved: DWORD;
  209.     dwAlphaDestConstBitDepth: DWORD;       // Bit depth used to specify alpha constant for destination
  210.     case Integer of
  211.     0: (
  212.       dwAlphaDestConst: DWORD;               // Constant to use as alpha channel for dest
  213.       dwAlphaSrcConstBitDepth: DWORD;        // Bit depth used to specify alpha constant for source
  214.       dwAlphaSrcConst: DWORD;                // Constant to use as alpha channel for src
  215.       dckDestColorkey: TDDCOLORKEY;                // DestColorkey override
  216.       dckSrcColorkey: TDDCOLORKEY;                 // DestColorkey override
  217.       dwDDFX: DWORD;                         // Overlay FX
  218.       dwFlags: DWORD;                        // flags
  219.      );
  220.     1: (
  221.       lpDDSAlphaDest: IDirectDrawSurface;     // Surface to use as alpha channel for dest
  222.       UNIONFILLER1b: DWORD;
  223.       lpDDSAlphaSrc: IDirectDrawSurface;      // Surface to use as alpha channel for src
  224.      );
  225.   end;
  226.   PDDOVERLAYFX = ^TDDOVERLAYFX;
  227.  
  228. (*
  229.  * DDBLTBATCH: BltBatch entry structure
  230.  *)
  231.  
  232.   TDDBLTBATCH = record
  233.     lprDest: PRect;
  234.     lpDDSSrc: IDirectDrawSurface;
  235.     lprSrc: PRect;
  236.     dwFlags: DWORD;
  237.     lpDDBltFx: PDDBLTFX;
  238.   end;
  239.   PDDBLTBATCH = ^TDDBLTBATCH;
  240.  
  241. (*
  242.  * DDSURFACEDESC
  243.  *)
  244.  
  245.   TDDSURFACEDESC = record
  246.     dwSize: DWORD;                 // size of the DDSURFACEDESC structure
  247.     dwFlags: DWORD;                // determines what fields are valid
  248.     dwHeight: DWORD;               // height of surface to be created
  249.     dwWidth: DWORD;                // width of input surface
  250.     lPitch: LongInt;                 // distance to start of next line (return value only)
  251.     dwBackBufferCount: DWORD;      // number of back buffers requested
  252.     case Integer of
  253.     0: (
  254.       dwMipMapCount: DWORD;          // number of mip-map levels requested
  255.       dwAlphaBitDepth: DWORD;        // depth of alpha buffer requested
  256.       dwReserved: DWORD;             // reserved
  257.       lpSurface: Pointer;              // pointer to the associated surface memory
  258.       ddckCKDestOverlay: TDDCOLORKEY;      // color key for destination overlay use
  259.       ddckCKDestBlt: TDDCOLORKEY;          // color key for destination blt use
  260.       ddckCKSrcOverlay: TDDCOLORKEY;       // color key for source overlay use
  261.       ddckCKSrcBlt: TDDCOLORKEY;           // color key for source blt use
  262.       ddpfPixelFormat: TDDPIXELFORMAT;        // pixel format description of the surface
  263.       ddsCaps: TDDSCAPS;                // direct draw surface capabilities
  264.      );
  265.     1: (
  266.       dwZBufferBitDepth: DWORD;      // depth of Z buffer requested
  267.      );
  268.     2: (
  269.       dwRefreshRate: DWORD;          // refresh rate (used when display mode is described)
  270.      );
  271.   end;
  272.   PDDSURFACEDESC = ^TDDSURFACEDESC;
  273.  
  274.   TCLIPPERCALLBACK = function (const DDClipper: IDirectDrawClipper; hWnd: HWND;
  275.     code: DWORD; lpContext: Pointer): DWORD; stdcall;
  276.  
  277.   TDDENUMMODESCALLBACK = function (const lpDDSurfaceDesc: TDDSURFACEDESC;
  278.       lpContext: Pointer): HRESULT; stdcall;
  279.   TDDENUMSURFACESCALLBACK = function (const DDSurface: IDirectDrawSurface;
  280.       const lpDDSurfaceDesc: TDDSURFACEDESC; lpContext: Pointer): HRESULT;
  281.       stdcall;
  282.  
  283. (*
  284.  * IDirectDraw
  285.  *)
  286.  
  287.   IDirectDraw = interface (IUnknown)
  288.     ['{6C14DB80-A733-11CE-A521-0020AF0BE560}']
  289.     function Compact: HRESULT; stdcall;
  290.     function CreateClipper (dwFlags: DWORD; out DDClipper: IDirectDrawClipper;
  291.         const pUnkOuter: IUnknown): HRESULT; stdcall;
  292.     function CreatePalette (dwFlags: DWORD; lpColorTable: PPaletteEntry;
  293.         out DDPalette: IDirectDrawPalette;
  294.         pUnkOuter: IUnknown): HRESULT; stdcall;
  295.     function CreateSurface (const lpDDSurfaceDesc: TDDSURFACEDESC;
  296.         out DDSurface: IDirectDrawSurface;
  297.         pUnkOuter: IUnknown): HRESULT; stdcall;
  298.     function DuplicateSurface (const DDSurface: IDirectDrawSurface;
  299.         out DupDDSurface: IDirectDrawSurface): HRESULT; stdcall;
  300.     function EnumDisplayModes (dwFlags: DWORD;
  301.         lpDDSurfaceDesc: PDDSURFACEDESC; lpContext: Pointer;
  302.         lpEnumModesCallback: TDDENUMMODESCALLBACK): HRESULT; stdcall;
  303.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSURFACEDESC;
  304.         lpContext: Pointer;
  305.         lpEnumCallback: TDDENUMSURFACESCALLBACK):HRESULT; stdcall;
  306.     function FlipToGDISurface: HRESULT; stdcall;
  307.     function GetCaps (var lpDDDriverCaps: TDDCAPS;
  308.         var lpDDHELCaps: TDDCAPS): HRESULT; stdcall;
  309.     function GetDisplayMode (var lpDDSurfaceDesc: TDDSURFACEDESC): HRESULT;
  310.         stdcall;
  311.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: Pointer): HRESULT;
  312.         stdcall;
  313.     function GetGDISurface (out GDIDDSSurface: IDirectDrawSurface): HRESULT;
  314.         stdcall;
  315.     function GetMonitorFrequency (var lpdwFrequency: DWORD): HRESULT;
  316.         stdcall;
  317.     function GetScanLine (var lpdwScanLine: DWORD): HRESULT; stdcall;
  318.     function GetVerticalBlankStatus (var lpbIsInVB: BOOL): HRESULT; stdcall;
  319.     function Initialize (const GUID: TGUID): HRESULT; stdcall;
  320.     function RestoreDisplayMode: HRESULT; stdcall;
  321.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD): HRESULT;
  322.         stdcall;
  323. (*** Warning!  IDirectDraw.SetDisplayMode <> IDirectDraw2.SetDisplayMode ***)
  324.     function SetDisplayMode (dwWidth, dwHeight, dwBpp: DWORD): HRESULT; stdcall;
  325.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle): HRESULT;
  326.         stdcall;
  327.   end;
  328.  
  329.   IDirectDraw2 = interface (IUnknown)
  330.     ['{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}']
  331.     function Compact: HRESULT; stdcall;
  332.     function CreateClipper (dwFlags: DWORD; out DDClipper: IDirectDrawClipper;
  333.         const pUnkOuter: IUnknown): HRESULT; stdcall;
  334.     function CreatePalette (dwFlags: DWORD; lpColorTable: PPaletteEntry;
  335.         out DDPalette: IDirectDrawPalette;
  336.         pUnkOuter: IUnknown): HRESULT; stdcall;
  337.     function CreateSurface (const lpDDSurfaceDesc: TDDSURFACEDESC;
  338.         out DDSurface: IDirectDrawSurface;
  339.         pUnkOuter: IUnknown): HRESULT; stdcall;
  340.     function DuplicateSurface (const DDSurface: IDirectDrawSurface;
  341.         out DupDDSurface: IDirectDrawSurface): HRESULT; stdcall;
  342.     function EnumDisplayModes (dwFlags: DWORD;
  343.         lpDDSurfaceDesc: PDDSURFACEDESC; lpContext: Pointer;
  344.         lpEnumModesCallback: TDDENUMMODESCALLBACK): HRESULT; stdcall;
  345.     function EnumSurfaces (dwFlags: DWORD; const lpDDSD: TDDSURFACEDESC;
  346.         lpContext: Pointer;
  347.         lpEnumCallback: TDDENUMSURFACESCALLBACK):HRESULT; stdcall;
  348.     function FlipToGDISurface: HRESULT; stdcall;
  349.     function GetCaps (var lpDDDriverCaps: TDDCAPS;
  350.         var lpDDHELCaps: TDDCAPS): HRESULT; stdcall;
  351.     function GetDisplayMode (var lpDDSurfaceDesc: TDDSURFACEDESC): HRESULT;
  352.         stdcall;
  353.     function GetFourCCCodes (var lpNumCodes: DWORD; lpCodes: Pointer): HRESULT;
  354.         stdcall;
  355.     function GetGDISurface (out GDIDDSSurface: IDirectDrawSurface): HRESULT;
  356.         stdcall;
  357.     function GetMonitorFrequency (var lpdwFrequency: DWORD): HRESULT;
  358.         stdcall;
  359.     function GetScanLine (var lpdwScanLine: DWORD): HRESULT; stdcall;
  360.     function GetVerticalBlankStatus (var lpbIsInVB: BOOL): HRESULT; stdcall;
  361.     function Initialize (const GUID: TGUID): HRESULT; stdcall;
  362.     function RestoreDisplayMode: HRESULT; stdcall;
  363.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD): HRESULT;
  364.         stdcall;
  365.     (*** Warning!  SetDisplayMode differs between DirectDraw 1 and DirectDraw 2 ***)
  366.     function SetDisplayMode (dwWidth, dwHeight, dwBPP, dwRefreshRate,
  367.        dwFlags: DWORD): HRESULT; stdcall;
  368.     function WaitForVerticalBlank (dwFlags: DWORD; hEvent: THandle): HRESULT;
  369.        stdcall;
  370.     function GetAvailableVidMem (var lpDDSCaps: TDDSCAPS;
  371.         var lpdwTotal, lpdwFree: DWORD): HRESULT; stdcall;
  372.   end;
  373.  
  374. (*
  375.  * IDirectDrawPalette
  376.  *)
  377.  
  378.   IDirectDrawPalette = interface (IUnknown)
  379.     ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
  380.     function GetCaps (var lpdwCaps: DWORD): HRESULT; stdcall;
  381.     function GetEntries (dwFlags, dwBase, dwNumEntries: DWORD;
  382.         lpEntries: PPaletteEntry): HRESULT; stdcall;
  383.     function Initialize (const DD: IDirectDraw; dwFlags: DWORD;
  384.         lpDDColorTable: PPaletteEntry): HRESULT; stdcall;
  385.     function SetEntries (dwFlags, dwStartingEntry, dwCount: DWORD;
  386.         lpEntries: PPaletteEntry): HRESULT; stdcall;
  387.   end;
  388.  
  389. (*
  390.  * IDirectDrawClipper
  391.  *)
  392.  
  393.   IDirectDrawClipper = interface (IUnknown)
  394.     ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
  395.     function GetClipList (const lpRect: TRect; lpClipList: PRgnData;
  396.         var lpdwSize: DWORD): HRESULT; stdcall;
  397.     function GetHWnd (var lphWnd: HWND): HRESULT; stdcall;
  398.     function Initialize (const DD: IDirectDraw; dwFlags: DWORD): HRESULT;
  399.         stdcall;
  400.     function IsClipListChanged (var lpbChanged: BOOL): HRESULT; stdcall;
  401.     function SetClipList (lpClipList: PRgnData; dwFlags: DWORD): HRESULT;
  402.         stdcall;
  403.     function SetHWnd (dwFlags: DWORD; hWnd: HWND): HRESULT; stdcall;
  404.   end;
  405.  
  406. (*
  407.  * IDirectDrawSurface
  408.  *)
  409.  
  410.   IDirectDrawSurface = interface (IUnknown)
  411.     ['{6C14DB81-A733-11CE-A521-0020AF0BE560}']
  412.     function AddAttachedSurface (
  413.         const DDSAttachedSurface: IDirectDrawSurface): HRESULT; stdcall;
  414.     function AddOverlayDirtyRect (const lpRect: TRect): HRESULT; stdcall;
  415.     function Blt (const lpDestRect: TRect;
  416.         const DDSrcSurface: IDirectDrawSurface; const lpSrcRect: TRect;
  417.         dwFlags: DWORD; const lpDDBltFx: TDDBLTFX): HRESULT; stdcall;
  418.     function BltBatch (const lpDDBltBatch: TDDBLTBATCH; dwCount: DWORD;
  419.         dwFlags: DWORD): HRESULT; stdcall;
  420.     function BltFast (dwX: DWORD; dwY: DWORD;
  421.         const DDSrcSurface: IDirectDrawSurface; const lpSrcRect: TRect;
  422.         dwTrans: DWORD): HRESULT; stdcall;
  423.     function DeleteAttachedSurface (dwFlags: DWORD;
  424.         const DDSAttachedSurface: IDirectDrawSurface): HRESULT; stdcall;
  425.     function EnumAttachedSurfaces (lpContext: Pointer;
  426.         lpEnumSurfacesCallback: TDDENUMSURFACESCALLBACK): HRESULT; stdcall;
  427.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  428.         lpfnCallback: TDDENUMSURFACESCALLBACK): HRESULT; stdcall;
  429.     function Flip (const DDSurfaceTargetOverride: IDirectDrawSurface;
  430.         dwFlags: DWORD): HRESULT; stdcall;
  431.     function GetAttachedSurface (var lpDDSCaps: TDDSCAPS;
  432.         out DDAttachedSurface: IDirectDrawSurface): HRESULT; stdcall;
  433.     function GetBltStatus (dwFlags: DWORD): HRESULT; stdcall;
  434.     function GetCaps (var lpDDSCaps: TDDSCAPS): HRESULT; stdcall;
  435.     function GetClipper (out DDClipper: IDirectDrawClipper): HRESULT;
  436.         stdcall;
  437.     function GetColorKey (dwFlags: DWORD;
  438.         var lpDDColorKey: TDDCOLORKEY): HRESULT; stdcall;
  439.     function GetDC (var lphDC: HDC): HRESULT; stdcall;
  440.     function GetFlipStatus (dwFlags: DWORD): HRESULT; stdcall;
  441.     function GetOverlayPosition (var lplX, lplY: LongInt): HRESULT; stdcall;
  442.     function GetPalette (out DDPalette: IDirectDrawPalette): HRESULT;
  443.         stdcall;
  444.     function GetPixelFormat (var lpDDPixelFormat: TDDPIXELFORMAT): HRESULT;
  445.         stdcall;
  446.     function GetSurfaceDesc (var lpDDSurfaceDesc: TDDSURFACEDESC): HRESULT;
  447.         stdcall;
  448.     function Initialize (const DD: IDirectDraw;
  449.         const lpDDSurfaceDesc: TDDSURFACEDESC): HRESULT; stdcall;
  450.     function IsLost: HRESULT; stdcall;
  451.     function Lock (lpDestRect: PRect;
  452.         var lpDDSurfaceDesc: TDDSURFACEDESC; dwFlags: DWORD;
  453.         hEvent: THandle): HRESULT; stdcall;
  454.     function ReleaseDC (hDC: HDC): HRESULT; stdcall;
  455.     function Restore: HRESULT; stdcall;
  456.     function SetClipper (const DDClipper: IDirectDrawClipper): HRESULT; stdcall;
  457.     function SetColorKey (dwFlags: DWORD;
  458.         const lpDDColorKey: TDDCOLORKEY): HRESULT; stdcall;
  459.     function SetOverlayPosition (lX, lY: LongInt): HRESULT; stdcall;
  460.     function SetPalette (const DDPalette: IDirectDrawPalette): HRESULT; stdcall;
  461.     function Unlock (lpSurfaceData: Pointer): HRESULT; stdcall;
  462.     function UpdateOverlay (const lpSrcRect: TRect;
  463.         const lpDDDestSurface: IDirectDrawSurface; const lpDestRect: TRect;
  464.         dwFlags: DWORD; const lpDDOverlayFx: TDDOVERLAYFX): HRESULT; stdcall;
  465.     function UpdateOverlayDisplay (dwFlags: DWORD): HRESULT; stdcall;
  466.     function UpdateOverlayZOrder (dwFlags: DWORD;
  467.         const DDSReference: IDirectDrawSurface): HRESULT; stdcall;
  468.   end;
  469.  
  470. (*
  471.  * IDirectDrawSurface2
  472.  *)
  473.  
  474.   IDirectDrawSurface2 = interface (IUnknown)
  475.     ['{57805885-6eec-11cf-9441-a82303c10e27}']
  476.     function AddAttachedSurface (
  477.         const DDSAttachedSurface: IDirectDrawSurface): HRESULT; stdcall;
  478.     function AddOverlayDirtyRect (const lpRect: TRect): HRESULT; stdcall;
  479.     function Blt (const lpDestRect: TRect;
  480.         const DDSrcSurface: IDirectDrawSurface; const lpSrcRect: TRect;
  481.         dwFlags: DWORD; const lpDDBltFx: TDDBLTFX): HRESULT; stdcall;
  482.     function BltBatch (const lpDDBltBatch: TDDBLTBATCH; dwCount: DWORD;
  483.         dwFlags: DWORD): HRESULT; stdcall;
  484.     function BltFast (dwX: DWORD; dwY: DWORD;
  485.         const DDSrcSurface: IDirectDrawSurface; const lpSrcRect: TRect;
  486.         dwTrans: DWORD): HRESULT; stdcall;
  487.     function DeleteAttachedSurface (dwFlags: DWORD;
  488.         const DDSAttachedSurface: IDirectDrawSurface): HRESULT; stdcall;
  489.     function EnumAttachedSurfaces (lpContext: Pointer;
  490.         lpEnumSurfacesCallback: TDDENUMSURFACESCALLBACK): HRESULT; stdcall;
  491.     function EnumOverlayZOrders (dwFlags: DWORD; lpContext: Pointer;
  492.         lpfnCallback: TDDENUMSURFACESCALLBACK): HRESULT; stdcall;
  493.     function Flip (const DDSurfaceTargetOverride: IDirectDrawSurface;
  494.         dwFlags: DWORD): HRESULT; stdcall;
  495.     function GetAttachedSurface (var lpDDSCaps: TDDSCAPS;
  496.         out DDAttachedSurface: IDirectDrawSurface): HRESULT; stdcall;
  497.     function GetBltStatus (dwFlags: DWORD): HRESULT; stdcall;
  498.     function GetCaps (var lpDDSCaps: TDDSCAPS): HRESULT; stdcall;
  499.     function GetClipper (out DDClipper: IDirectDrawClipper): HRESULT;
  500.         stdcall;
  501.     function GetColorKey (dwFlags: DWORD;
  502.         var lpDDColorKey: TDDCOLORKEY): HRESULT; stdcall;
  503.     function GetDC (var lphDC: HDC): HRESULT; stdcall;
  504.     function GetFlipStatus (dwFlags: DWORD): HRESULT; stdcall;
  505.     function GetOverlayPosition (var lplX, lplY: LongInt): HRESULT; stdcall;
  506.     function GetPalette (out DDPalette: IDirectDrawPalette): HRESULT;
  507.         stdcall;
  508.     function GetPixelFormat (var lpDDPixelFormat: TDDPIXELFORMAT): HRESULT;
  509.         stdcall;
  510.     function GetSurfaceDesc (var lpDDSurfaceDesc: TDDSURFACEDESC): HRESULT;
  511.         stdcall;
  512.     function Initialize (const DD: IDirectDraw;
  513.         const lpDDSurfaceDesc: TDDSURFACEDESC): HRESULT; stdcall;
  514.     function IsLost: HRESULT; stdcall;
  515.     function Lock (lpDestRect: PRect;
  516.         var lpDDSurfaceDesc: TDDSURFACEDESC; dwFlags: DWORD;
  517.         hEvent: THandle): HRESULT; stdcall;
  518.     function ReleaseDC (hDC: HDC): HRESULT; stdcall;
  519.     function Restore: HRESULT; stdcall;
  520.     function SetClipper (const DDClipper: IDirectDrawClipper): HRESULT; stdcall;
  521.     function SetColorKey (dwFlags: DWORD;
  522.         const lpDDColorKey: TDDCOLORKEY): HRESULT; stdcall;
  523.     function SetOverlayPosition (lX, lY: LongInt): HRESULT; stdcall;
  524.     function SetPalette (const DDPalette: IDirectDrawPalette): HRESULT; stdcall;
  525.     function Unlock (lpSurfaceData: Pointer): HRESULT; stdcall;
  526.     function UpdateOverlay (const lpSrcRect: TRect;
  527.         const lpDDDestSurface: IDirectDrawSurface; const lpDestRect: TRect;
  528.         dwFlags: DWORD; const lpDDOverlayFx: TDDOVERLAYFX): HRESULT; stdcall;
  529.     function UpdateOverlayDisplay (dwFlags: DWORD): HRESULT; stdcall;
  530.     function UpdateOverlayZOrder (dwFlags: DWORD;
  531.         const DDSReference: IDirectDrawSurface): HRESULT; stdcall;
  532.     (*** Added in the v2 interface ***)
  533.     function GetDDInterface (out DD: IDirectDraw): HRESULT; stdcall;
  534.     function PageLock (dwFlags: DWORD): HRESULT; stdcall;
  535.     function PageUnlock (dwFlags: DWORD): HRESULT; stdcall;
  536.   end;
  537.  
  538. const
  539.  
  540. (*
  541.  * ddsCaps field is valid.
  542.  *)
  543.  
  544.   DDSD_CAPS               = $00000001;     // default
  545.  
  546. (*
  547.  * dwHeight field is valid.
  548.  *)
  549.  
  550.   DDSD_HEIGHT             = $00000002;
  551.  
  552. (*
  553.  * dwWidth field is valid.
  554.  *)
  555.  
  556.   DDSD_WIDTH              = $00000004;
  557.  
  558. (*
  559.  * lPitch is valid.
  560.  *)
  561.  
  562.   DDSD_PITCH              = $00000008;
  563.  
  564. (*
  565.  * dwBackBufferCount is valid.
  566.  *)
  567.  
  568.   DDSD_BACKBUFFERCOUNT    = $00000020;
  569.  
  570. (*
  571.  * dwZBufferBitDepth is valid.
  572.  *)
  573.  
  574.   DDSD_ZBUFFERBITDEPTH    = $00000040;
  575.  
  576. (*
  577.  * dwAlphaBitDepth is valid.
  578.  *)
  579.  
  580.   DDSD_ALPHABITDEPTH      = $00000080;
  581.  
  582.  
  583.  
  584. (*
  585.  * ddpfPixelFormat is valid.
  586.  *)
  587.  
  588.   DDSD_PIXELFORMAT        = $00001000;
  589.  
  590. (*
  591.  * ddckCKDestOverlay is valid.
  592.  *)
  593.  
  594.   DDSD_CKDESTOVERLAY      = $00002000;
  595.  
  596. (*
  597.  * ddckCKDestBlt is valid.
  598.  *)
  599.  
  600.   DDSD_CKDESTBLT          = $00004000;
  601.  
  602. (*
  603.  * ddckCKSrcOverlay is valid.
  604.  *)
  605.  
  606.   DDSD_CKSRCOVERLAY       = $00008000;
  607.  
  608. (*
  609.  * ddckCKSrcBlt is valid.
  610.  *)
  611.  
  612.   DDSD_CKSRCBLT           = $00010000;
  613.  
  614. (*
  615.  * dwMipMapCount is valid.
  616.  *)
  617.  
  618.   DDSD_MIPMAPCOUNT        = $00020000;
  619.  
  620.  (*
  621.   * dwRefreshRate is valid
  622.   *)
  623.  
  624.   DDSD_REFRESHRATE        = $00040000;
  625.  
  626.  
  627. (*
  628.  * All input fields are valid.
  629.  *)
  630.  
  631.   DDSD_ALL                = $0007f9ee;
  632.  
  633.  
  634. (*============================================================================
  635.  *
  636.  * Direct Draw Capability Flags
  637.  *
  638.  * These flags are used to describe the capabilities of a given Surface.
  639.  * All flags are bit flags.
  640.  *
  641.  *==========================================================================*)
  642.  
  643. (****************************************************************************
  644.  *
  645.  * DIRECTDRAWSURFACE CAPABILITY FLAGS
  646.  *
  647.  ****************************************************************************)
  648. (*
  649.  * This bit currently has no meaning.
  650.  *)
  651.  
  652.   DDSCAPS_3D                              = $00000001;
  653.  
  654. (*
  655.  * Indicates that this surface contains alpha information.  The pixel
  656.  * format must be interrogated to determine whether this surface
  657.  * contains only alpha information or alpha information interlaced
  658.  * with pixel color data (e.g. RGBA or YUVA).
  659.  *)
  660.  
  661.   DDSCAPS_ALPHA                           = $00000002;
  662.  
  663. (*
  664.  * Indicates that this surface is a backbuffer.  It is generally
  665.  * set by CreateSurface when the DDSCAPS_FLIP capability bit is set.
  666.  * It indicates that this surface is THE back buffer of a surface
  667.  * flipping structure.  DirectDraw supports N surfaces in a
  668.  * surface flipping structure.  Only the surface that immediately
  669.  * precedeces the DDSCAPS_FRONTBUFFER has this capability bit set.
  670.  * The other surfaces are identified as back buffers by the presence
  671.  * of the DDSCAPS_FLIP capability, their attachment order, and the
  672.  * absence of the DDSCAPS_FRONTBUFFER and DDSCAPS_BACKBUFFER
  673.  * capabilities.  The bit is sent to CreateSurface when a standalone
  674.  * back buffer is being created.  This surface could be attached to
  675.  * a front buffer and/or back buffers to form a flipping surface
  676.  * structure after the CreateSurface call.  See AddAttachments for
  677.  * a detailed description of the behaviors in this case.
  678.  *)
  679.  
  680.   DDSCAPS_BACKBUFFER                      = $00000004;
  681.  
  682. (*
  683.  * Indicates a complex surface structure is being described.  A
  684.  * complex surface structure results in the creation of more than
  685.  * one surface.  The additional surfaces are attached to the root
  686.  * surface.  The complex structure can only be destroyed by
  687.  * destroying the root.
  688.  *)
  689.  
  690.   DDSCAPS_COMPLEX                         = $00000008;
  691.  
  692. (*
  693.  * Indicates that this surface is a part of a surface flipping structure.
  694.  * When it is passed to CreateSurface the DDSCAPS_FRONTBUFFER and
  695.  * DDSCAP_BACKBUFFER bits are not set.  They are set by CreateSurface
  696.  * on the resulting creations.  The dwBackBufferCount field in the
  697.  * DDSURFACEDESC structure must be set to at least 1 in order for
  698.  * the CreateSurface call to succeed.  The DDSCAPS_COMPLEX capability
  699.  * must always be set with creating multiple surfaces through CreateSurface.
  700.  *)
  701.  
  702.   DDSCAPS_FLIP                            = $00000010;
  703.  
  704. (*
  705.  * Indicates that this surface is THE front buffer of a surface flipping
  706.  * structure.  It is generally set by CreateSurface when the DDSCAPS_FLIP
  707.  * capability bit is set.
  708.  * If this capability is sent to CreateSurface then a standalonw front buffer
  709.  * is created.  This surface will not have the DDSCAPS_FLIP capability.
  710.  * It can be attached to other back buffers to form a flipping structure.
  711.  * See AddAttachments for a detailed description of the behaviors in this
  712.  * case.
  713.  *)
  714.  
  715.   DDSCAPS_FRONTBUFFER                     = $00000020;
  716.  
  717. (*
  718.  * Indicates that this surface is any offscreen surface that is not an overlay,
  719.  * texture, zbuffer, front buffer, back buffer, or alpha surface.  It is used
  720.  * to identify plain vanilla surfaces.
  721.  *)
  722.  
  723.   DDSCAPS_OFFSCREENPLAIN                  = $00000040;
  724.  
  725. (*
  726.  * Indicates that this surface is an overlay.  It may or may not be directly visible
  727.  * depending on whether or not it is currently being overlayed onto the primary
  728.  * surface.  DDSCAPS_VISIBLE can be used to determine whether or not it is being
  729.  * overlayed at the moment.
  730.  *)
  731.  
  732.   DDSCAPS_OVERLAY                         = $00000080;
  733.  
  734. (*
  735.  * Indicates that unique DirectDrawPalette objects can be created and
  736.  * attached to this surface.
  737.  *)
  738.  
  739.   DDSCAPS_PALETTE                         = $00000100;
  740.  
  741. (*
  742.  * Indicates that this surface is the primary surface.  The primary
  743.  * surface represents what the user is seeing at the moment.
  744.  *)
  745.  
  746.   DDSCAPS_PRIMARYSURFACE                  = $00000200;
  747.  
  748. (*
  749.  * Indicates that this surface is the primary surface for the left eye.
  750.  * The primary surface for the left eye represents what the user is seeing
  751.  * at the moment with the users left eye.  When this surface is created the
  752.  * DDSCAPS_PRIMARYSURFACE represents what the user is seeing with the users
  753.  * right eye.
  754.  *)
  755.  
  756.   DDSCAPS_PRIMARYSURFACELEFT              = $00000400;
  757.  
  758. (*
  759.  * Indicates that this surface memory was allocated in system memory
  760.  *)
  761.  
  762.   DDSCAPS_SYSTEMMEMORY                    = $00000800;
  763.  
  764. (*
  765.  * Indicates that this surface can be used as a 3D texture.  It does not
  766.  * indicate whether or not the surface is being used for that purpose.
  767.  *)
  768.  
  769.   DDSCAPS_TEXTURE                         = $00001000;
  770.  
  771. (*
  772.  * Indicates that a surface may be a destination for 3D rendering.  This
  773.  * bit must be set in order to query for a Direct3D Device Interface
  774.  * from this surface.
  775.  *)
  776.  
  777.   DDSCAPS_3DDEVICE                        = $00002000;
  778.  
  779. (*
  780.  * Indicates that this surface exists in video memory.
  781.  *)
  782.  
  783.   DDSCAPS_VIDEOMEMORY                     = $00004000;
  784.  
  785. (*
  786.  * Indicates that changes made to this surface are immediately visible.
  787.  * It is always set for the primary surface and is set for overlays while
  788.  * they are being overlayed and texture maps while they are being textured.
  789.  *)
  790.  
  791.   DDSCAPS_VISIBLE                         = $00008000;
  792.  
  793. (*
  794.  * Indicates that only writes are permitted to the surface.  Read accesses
  795.  * from the surface may or may not generate a protection fault, but the
  796.  * results of a read from this surface will not be meaningful.  READ ONLY.
  797.  *)
  798.  
  799.   DDSCAPS_WRITEONLY                       = $00010000;
  800.  
  801. (*
  802.  * Indicates that this surface is a z buffer. A z buffer does not contain
  803.  * displayable information.  Instead it contains bit depth information that is
  804.  * used to determine which pixels are visible and which are obscured.
  805.  *)
  806.  
  807.   DDSCAPS_ZBUFFER                         = $00020000;
  808.  
  809. (*
  810.  * Indicates surface will have a DC associated long term
  811.  *)
  812.  
  813.   DDSCAPS_OWNDC                           = $00040000;
  814.  
  815. (*
  816.  * Indicates surface should be able to receive live video
  817.  *)
  818.  
  819.   DDSCAPS_LIVEVIDEO                       = $00080000;
  820.  
  821. (*
  822.  * Indicates surface should be able to have a stream decompressed
  823.  * to it by the hardware.
  824.  *)
  825.  
  826.   DDSCAPS_HWCODEC                         = $00100000;
  827.  
  828. (*
  829.  * Surface is a 320x200 or 320x240 ModeX surface
  830.  *)
  831.  
  832.   DDSCAPS_MODEX                           = $00200000;
  833.  
  834. (*
  835.  * Indicates surface is one level of a mip-map. This surface will
  836.  * be attached to other DDSCAPS_MIPMAP surfaces to form the mip-map.
  837.  * This can be done explicitly, by creating a number of surfaces and
  838.  * attaching them with AddAttachedSurface or by implicitly by CreateSurface.
  839.  * If this bit is set then DDSCAPS_TEXTURE must also be set.
  840.  *)
  841.  
  842.   DDSCAPS_MIPMAP                          = $00400000;
  843.  
  844.  
  845.  
  846. (*
  847.  * Indicates that memory for the surface is not allocated until the surface
  848.  * is loaded (via the Direct3D texture Load() function).
  849.  *)
  850.  
  851.   DDSCAPS_ALLOCONLOAD                     = $04000000;
  852.  
  853.  
  854.  
  855.  (****************************************************************************
  856.  *
  857.  * DIRECTDRAW DRIVER CAPABILITY FLAGS
  858.  *
  859.  ****************************************************************************)
  860.  
  861. (*
  862.  * Display hardware has 3D acceleration.
  863.  *)
  864.  
  865.   DDCAPS_3D                       = $00000001;
  866.  
  867. (*
  868.  * Indicates that DirectDraw will support only dest rectangles that are aligned
  869.  * on DIRECTDRAWCAPS.dwAlignBoundaryDest boundaries of the surface, respectively.
  870.  * READ ONLY.
  871.  *)
  872.  
  873.   DDCAPS_ALIGNBOUNDARYDEST        = $00000002;
  874.  
  875. (*
  876.  * Indicates that DirectDraw will support only source rectangles  whose sizes in 
  877.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeDest multiples, respectively.  READ ONLY.
  878.  *)
  879.  
  880.   DDCAPS_ALIGNSIZEDEST            = $00000004;
  881. (*
  882.  * Indicates that DirectDraw will support only source rectangles that are aligned
  883.  * on DIRECTDRAWCAPS.dwAlignBoundarySrc boundaries of the surface, respectively.
  884.  * READ ONLY.
  885.  *)
  886.  
  887.   DDCAPS_ALIGNBOUNDARYSRC         = $00000008;
  888.  
  889. (*
  890.  * Indicates that DirectDraw will support only source rectangles  whose sizes in 
  891.  * BYTEs are DIRECTDRAWCAPS.dwAlignSizeSrc multiples, respectively.  READ ONLY.
  892.  *)
  893.  
  894.   DDCAPS_ALIGNSIZESRC             = $00000010;
  895.  
  896. (*
  897.  * Indicates that DirectDraw will create video memory surfaces that have a stride 
  898.  * alignment equal to DIRECTDRAWCAPS.dwAlignStride.  READ ONLY.
  899.  *)
  900.  
  901.   DDCAPS_ALIGNSTRIDE              = $00000020;
  902.  
  903. (*
  904.  * Display hardware is capable of blt operations.
  905.  *)
  906.  
  907.   DDCAPS_BLT                      = $00000040;
  908.  
  909. (*
  910.  * Display hardware is capable of asynchronous blt operations.
  911.  *)
  912.  
  913.   DDCAPS_BLTQUEUE                 = $00000080;
  914.  
  915. (*
  916.  * Display hardware is capable of color space conversions during the blt operation.
  917.  *)
  918.  
  919.   DDCAPS_BLTFOURCC                = $00000100;
  920.  
  921. (*
  922.  * Display hardware is capable of stretching during blt operations.
  923.  *)
  924.  
  925.   DDCAPS_BLTSTRETCH               = $00000200;
  926.  
  927. (*
  928.  * Display hardware is shared with GDI.
  929.  *)
  930.  
  931.   DDCAPS_GDI                      = $00000400;
  932.  
  933. (*
  934.  * Display hardware can overlay.
  935.  *)
  936.  
  937.   DDCAPS_OVERLAY                  = $00000800;
  938.  
  939. (*
  940.  * Set if display hardware supports overlays but can not clip them.
  941.  *)
  942.  
  943.   DDCAPS_OVERLAYCANTCLIP          = $00001000;
  944.  
  945. (*
  946.  * Indicates that overlay hardware is capable of color space conversions during
  947.  * the overlay operation.
  948.  *)
  949.  
  950.   DDCAPS_OVERLAYFOURCC            = $00002000;
  951.  
  952. (*
  953.  * Indicates that stretching can be done by the overlay hardware.
  954.  *)
  955.  
  956.   DDCAPS_OVERLAYSTRETCH           = $00004000;
  957.  
  958. (*
  959.  * Indicates that unique DirectDrawPalettes can be created for DirectDrawSurfaces
  960.  * other than the primary surface.
  961.  *)
  962.  
  963.   DDCAPS_PALETTE                  = $00008000;
  964.  
  965. (*
  966.  * Indicates that palette changes can be syncd with the veritcal refresh.
  967.  *)
  968.  
  969.   DDCAPS_PALETTEVSYNC             = $00010000;
  970.  
  971. (*
  972.  * Display hardware can return the current scan line.
  973.  *)
  974.  
  975.   DDCAPS_READSCANLINE             = $00020000;
  976.  
  977. (*
  978.  * Display hardware has stereo vision capabilities.  DDSCAPS_PRIMARYSURFACELEFT 
  979.  * can be created.
  980.  *)
  981.  
  982.   DDCAPS_STEREOVIEW               = $00040000;
  983.  
  984. (*
  985.  * Display hardware is capable of generating a vertical blank interrupt.
  986.  *)
  987.  
  988.   DDCAPS_VBI                      = $00080000;
  989.  
  990. (*
  991.  * Supports the use of z buffers with blt operations.
  992.  *)
  993.  
  994.   DDCAPS_ZBLTS                    = $00100000;
  995.  
  996. (*
  997.  * Supports Z Ordering of overlays.
  998.  *)
  999.  
  1000.   DDCAPS_ZOVERLAYS                = $00200000;
  1001.  
  1002. (*
  1003.  * Supports color key
  1004.  *)
  1005.  
  1006.   DDCAPS_COLORKEY                 = $00400000;
  1007.  
  1008. (*
  1009.  * Supports alpha surfaces
  1010.  *)
  1011.  
  1012.   DDCAPS_ALPHA                    = $00800000;
  1013.  
  1014. (*
  1015.  * colorkey is hardware assisted(DDCAPS_COLORKEY will also be set)
  1016.  *)
  1017.  
  1018.   DDCAPS_COLORKEYHWASSIST         = $01000000;
  1019.  
  1020. (*
  1021.  * no hardware support at all
  1022.  *)
  1023.  
  1024.   DDCAPS_NOHARDWARE               = $02000000;
  1025.  
  1026. (*
  1027.  * Display hardware is capable of color fill with bltter
  1028.  *)
  1029.  
  1030.   DDCAPS_BLTCOLORFILL             = $04000000;
  1031.  
  1032. (*
  1033.  * Display hardware is bank switched, and potentially very slow at
  1034.  * random access to VRAM.
  1035.  *)
  1036.  
  1037.   DDCAPS_BANKSWITCHED             = $08000000;
  1038.  
  1039. (*
  1040.  * Display hardware is capable of depth filling Z-buffers with bltter
  1041.  *)
  1042.  
  1043.   DDCAPS_BLTDEPTHFILL             = $10000000;
  1044.  
  1045. (*
  1046.  * Display hardware is capable of clipping while bltting.
  1047.  *)
  1048.  
  1049.   DDCAPS_CANCLIP                  = $20000000;
  1050.  
  1051. (*
  1052.  * Display hardware is capable of clipping while stretch bltting.
  1053.  *)
  1054.  
  1055.   DDCAPS_CANCLIPSTRETCHED         = $40000000;
  1056.  
  1057. (*
  1058.  * Display hardware is capable of bltting to or from system memory
  1059.  *)
  1060.  
  1061.   DDCAPS_CANBLTSYSMEM             = $80000000;
  1062.  
  1063.  
  1064.  (****************************************************************************
  1065.  *
  1066.  * MORE DIRECTDRAW DRIVER CAPABILITY FLAGS (dwCaps2)
  1067.  *
  1068.  ****************************************************************************)
  1069.  
  1070. (*
  1071.  * Display hardware is certified
  1072.  *)
  1073.  
  1074.   DDCAPS2_CERTIFIED               = $00000001;
  1075.  
  1076. (*
  1077.  * Driver cannot interleave 2D operations (lock and blt) to surfaces with
  1078.  * Direct3D rendering operations between calls to BeginScene() and EndScene()
  1079.  *)
  1080.  
  1081.   DDCAPS2_NO2DDURING3DSCENE       = $00000002;
  1082.  
  1083. (****************************************************************************
  1084.  *
  1085.  * DIRECTDRAW FX ALPHA CAPABILITY FLAGS
  1086.  *
  1087.  ****************************************************************************)
  1088.  
  1089. (*
  1090.  * Supports alpha blending around the edge of a source color keyed surface.
  1091.  * For Blt.
  1092.  *)
  1093.  
  1094.   DDFXALPHACAPS_BLTALPHAEDGEBLEND         = $00000001;
  1095.  
  1096. (*
  1097.  * Supports alpha information in the pixel format.  The bit depth of alpha 
  1098.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  1099.  * more opaque as the alpha value increases.  (0 is transparent.)
  1100.  * For Blt.
  1101.  *)
  1102.  
  1103.   DDFXALPHACAPS_BLTALPHAPIXELS            = $00000002;
  1104.  
  1105. (*
  1106.  * Supports alpha information in the pixel format.  The bit depth of alpha 
  1107.  * information in the pixel format can be 1,2,4, or 8.  The alpha value 
  1108.  * becomes more transparent as the alpha value increases.  (0 is opaque.) 
  1109.  * This flag can only be set if DDCAPS_ALPHA is set.
  1110.  * For Blt.
  1111.  *)
  1112.  
  1113.   DDFXALPHACAPS_BLTALPHAPIXELSNEG         = $00000004;
  1114.  
  1115. (*
  1116.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  1117.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  1118.  * (0 is transparent.)
  1119.  * For Blt.
  1120.  *)
  1121.  
  1122.   DDFXALPHACAPS_BLTALPHASURFACES          = $00000008;
  1123.  
  1124. (*
  1125.  * The depth of the alpha channel data can range can be 1,2,4, or 8.
  1126.  * The NEG suffix indicates that this alpha channel becomes more transparent
  1127.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  1128.  * DDCAPS_ALPHA is set.
  1129.  * For Blt.
  1130.  *)
  1131.  
  1132.   DDFXALPHACAPS_BLTALPHASURFACESNEG       = $00000010;
  1133.  
  1134. (*
  1135.  * Supports alpha blending around the edge of a source color keyed surface.
  1136.  * For Overlays.
  1137.  *)
  1138.  
  1139.   DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = $00000020;
  1140.  
  1141. (*
  1142.  * Supports alpha information in the pixel format.  The bit depth of alpha 
  1143.  * information in the pixel format can be 1,2,4, or 8.  The alpha value becomes
  1144.  * more opaque as the alpha value increases.  (0 is transparent.)
  1145.  * For Overlays.
  1146.  *)
  1147.  
  1148.   DDFXALPHACAPS_OVERLAYALPHAPIXELS        = $00000040;
  1149.  
  1150. (*
  1151.  * Supports alpha information in the pixel format.  The bit depth of alpha 
  1152.  * information in the pixel format can be 1,2,4, or 8.  The alpha value
  1153.  * becomes more transparent as the alpha value increases.  (0 is opaque.) 
  1154.  * This flag can only be set if DDCAPS_ALPHA is set.
  1155.  * For Overlays.
  1156.  *)
  1157.  
  1158.   DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = $00000080;
  1159.  
  1160. (*
  1161.  * Supports alpha only surfaces.  The bit depth of an alpha only surface can be
  1162.  * 1,2,4, or 8.  The alpha value becomes more opaque as the alpha value increases.
  1163.  * (0 is transparent.)
  1164.  * For Overlays.
  1165.  *)
  1166.  
  1167.   DDFXALPHACAPS_OVERLAYALPHASURFACES      = $00000100;
  1168.  
  1169. (*
  1170.  * The depth of the alpha channel data can range can be 1,2,4, or 8.  
  1171.  * The NEG suffix indicates that this alpha channel becomes more transparent
  1172.  * as the alpha value increases. (0 is opaque.)  This flag can only be set if
  1173.  * DDCAPS_ALPHA is set.
  1174.  * For Overlays.
  1175.  *)
  1176.  
  1177.   DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = $00000200;
  1178.  
  1179. (****************************************************************************
  1180.  *
  1181.  * DIRECTDRAW FX CAPABILITY FLAGS
  1182.  *
  1183.  ****************************************************************************)
  1184.  
  1185. (*
  1186.  * Uses arithmetic operations to stretch and shrink surfaces during blt
  1187.  * rather than pixel doubling techniques.  Along the Y axis.
  1188.  *)
  1189.  
  1190.   DDFXCAPS_BLTARITHSTRETCHY       = $00000020;
  1191.  
  1192. (*
  1193.  * Uses arithmetic operations to stretch during blt
  1194.  * rather than pixel doubling techniques.  Along the Y axis. Only
  1195.  * works for x1, x2, etc.
  1196.  *)
  1197.  
  1198.   DDFXCAPS_BLTARITHSTRETCHYN      = $00000010;
  1199.  
  1200. (*
  1201.  * Supports mirroring left to right in blt.
  1202.  *)
  1203.  
  1204.   DDFXCAPS_BLTMIRRORLEFTRIGHT     = $00000040;
  1205.  
  1206. (*
  1207.  * Supports mirroring top to bottom in blt.
  1208.  *)
  1209.  
  1210.   DDFXCAPS_BLTMIRRORUPDOWN        = $00000080;
  1211.  
  1212. (*
  1213.  * Supports arbitrary rotation for blts.
  1214.  *)
  1215.  
  1216.   DDFXCAPS_BLTROTATION            = $00000100;
  1217.  
  1218. (*
  1219.  * Supports 90 degree rotations for blts.
  1220.  *)
  1221.  
  1222.   DDFXCAPS_BLTROTATION90          = $00000200;
  1223.  
  1224. (*
  1225.  * DirectDraw supports arbitrary shrinking of a surface along the
  1226.  * x axis (horizontal direction) for blts.
  1227.  *)
  1228.  
  1229.   DDFXCAPS_BLTSHRINKX             = $00000400;
  1230.  
  1231. (*
  1232.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  1233.  * along the x axis (horizontal direction) for blts.
  1234.  *)
  1235.  
  1236.   DDFXCAPS_BLTSHRINKXN            = $00000800;
  1237.  
  1238. (*
  1239.  * DirectDraw supports arbitrary shrinking of a surface along the
  1240.  * y axis (horizontal direction) for blts.  
  1241.  *)
  1242.  
  1243.   DDFXCAPS_BLTSHRINKY             = $00001000;
  1244.  
  1245. (*
  1246.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  1247.  * along the y axis (vertical direction) for blts.
  1248.  *)
  1249.  
  1250.   DDFXCAPS_BLTSHRINKYN            = $00002000;
  1251.  
  1252. (*
  1253.  * DirectDraw supports arbitrary stretching of a surface along the
  1254.  * x axis (horizontal direction) for blts.
  1255.  *)
  1256.  
  1257.   DDFXCAPS_BLTSTRETCHX            = $00004000;
  1258.  
  1259. (*
  1260.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  1261.  * along the x axis (horizontal direction) for blts.
  1262.  *)
  1263.  
  1264.   DDFXCAPS_BLTSTRETCHXN           = $00008000;
  1265.  
  1266. (*
  1267.  * DirectDraw supports arbitrary stretching of a surface along the
  1268.  * y axis (horizontal direction) for blts.  
  1269.  *)
  1270.  
  1271.   DDFXCAPS_BLTSTRETCHY            = $00010000;
  1272.  
  1273. (*
  1274.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  1275.  * along the y axis (vertical direction) for blts.  
  1276.  *)
  1277.  
  1278.   DDFXCAPS_BLTSTRETCHYN           = $00020000;
  1279.  
  1280. (*
  1281.  * Uses arithmetic operations to stretch and shrink surfaces during 
  1282.  * overlay rather than pixel doubling techniques.  Along the Y axis 
  1283.  * for overlays.
  1284.  *)
  1285.  
  1286.   DDFXCAPS_OVERLAYARITHSTRETCHY   = $00040000;
  1287.  
  1288. (*
  1289.  * Uses arithmetic operations to stretch surfaces during 
  1290.  * overlay rather than pixel doubling techniques.  Along the Y axis
  1291.  * for overlays. Only works for x1, x2, etc.
  1292.  *)
  1293.  
  1294.   DDFXCAPS_OVERLAYARITHSTRETCHYN  = $00000008;
  1295.  
  1296. (*
  1297.  * DirectDraw supports arbitrary shrinking of a surface along the
  1298.  * x axis (horizontal direction) for overlays.
  1299.  *)
  1300.  
  1301.   DDFXCAPS_OVERLAYSHRINKX         = $00080000;
  1302.  
  1303. (*
  1304.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  1305.  * along the x axis (horizontal direction) for overlays.
  1306.  *)
  1307.  
  1308.   DDFXCAPS_OVERLAYSHRINKXN        = $00100000;
  1309.  
  1310. (*
  1311.  * DirectDraw supports arbitrary shrinking of a surface along the
  1312.  * y axis (horizontal direction) for overlays.  
  1313.  *)
  1314.  
  1315.   DDFXCAPS_OVERLAYSHRINKY         = $00200000;
  1316.  
  1317. (*
  1318.  * DirectDraw supports integer shrinking (1x,2x,) of a surface
  1319.  * along the y axis (vertical direction) for overlays.  
  1320.  *)
  1321.  
  1322.   DDFXCAPS_OVERLAYSHRINKYN        = $00400000;
  1323.  
  1324. (*
  1325.  * DirectDraw supports arbitrary stretching of a surface along the
  1326.  * x axis (horizontal direction) for overlays.
  1327.  *)
  1328.  
  1329.   DDFXCAPS_OVERLAYSTRETCHX        = $00800000;
  1330.  
  1331. (*
  1332.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  1333.  * along the x axis (horizontal direction) for overlays.
  1334.  *)
  1335.  
  1336.   DDFXCAPS_OVERLAYSTRETCHXN       = $01000000;
  1337.  
  1338. (*
  1339.  * DirectDraw supports arbitrary stretching of a surface along the
  1340.  * y axis (horizontal direction) for overlays.  
  1341.  *)
  1342.  
  1343.   DDFXCAPS_OVERLAYSTRETCHY        = $02000000;
  1344.  
  1345. (*
  1346.  * DirectDraw supports integer stretching (1x,2x,) of a surface
  1347.  * along the y axis (vertical direction) for overlays.  
  1348.  *)
  1349.  
  1350.   DDFXCAPS_OVERLAYSTRETCHYN       = $04000000;
  1351.  
  1352. (*
  1353.  * DirectDraw supports mirroring of overlays across the vertical axis
  1354.  *)
  1355.  
  1356.   DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = $08000000;
  1357.  
  1358. (*
  1359.  * DirectDraw supports mirroring of overlays across the horizontal axis
  1360.  *)
  1361.  
  1362.   DDFXCAPS_OVERLAYMIRRORUPDOWN    = $10000000;
  1363.  
  1364. (****************************************************************************
  1365.  *
  1366.  * DIRECTDRAW STEREO VIEW CAPABILITIES
  1367.  *
  1368.  ****************************************************************************)
  1369.  
  1370. (*
  1371.  * The stereo view is accomplished via enigma encoding.
  1372.  *)
  1373.  
  1374.   DDSVCAPS_ENIGMA                 = $00000001;
  1375.  
  1376. (*
  1377.  * The stereo view is accomplished via high frequency flickering.
  1378.  *)
  1379.  
  1380.   DDSVCAPS_FLICKER                = $00000002;
  1381.  
  1382. (*
  1383.  * The stereo view is accomplished via red and blue filters applied
  1384.  * to the left and right eyes.  All images must adapt their colorspaces
  1385.  * for this process.
  1386.  *)
  1387.  
  1388.   DDSVCAPS_REDBLUE                = $00000004;
  1389.  
  1390. (*
  1391.  * The stereo view is accomplished with split screen technology.
  1392.  *)
  1393.  
  1394.   DDSVCAPS_SPLIT                  = $00000008;
  1395.  
  1396. (****************************************************************************
  1397.  *
  1398.  * DIRECTDRAWPALETTE CAPABILITIES
  1399.  *
  1400.  ****************************************************************************)
  1401.  
  1402. (*
  1403.  * Index is 4 bits.  There are sixteen color entries in the palette table.
  1404.  *)
  1405.  
  1406.   DDPCAPS_4BIT                    = $00000001;
  1407.  
  1408. (*
  1409.  * Index is onto a 8 bit color index.  This field is only valid with the
  1410.  * DDPCAPS_1BIT, DDPCAPS_2BIT or DDPCAPS_4BIT capability and the target
  1411.  * surface is in 8bpp. Each color entry is one byte long and is an index
  1412.  * into destination surface's 8bpp palette.
  1413.  *)
  1414.  
  1415.   DDPCAPS_8BITENTRIES             = $00000002;
  1416.  
  1417. (*
  1418.  * Index is 8 bits.  There are 256 color entries in the palette table.
  1419.  *)
  1420.  
  1421.   DDPCAPS_8BIT                    = $00000004;
  1422.  
  1423. (*
  1424.  * Indicates that this DIRECTDRAWPALETTE should use the palette color array
  1425.  * passed into the lpDDColorArray parameter to initialize the DIRECTDRAWPALETTE
  1426.  * object.
  1427.  *)
  1428.  
  1429.   DDPCAPS_INITIALIZE              = $00000008;
  1430.  
  1431. (*
  1432.  * This palette is the one attached to the primary surface.  Changing this
  1433.  * table has immediate effect on the display unless DDPSETPAL_VSYNC is specified
  1434.  * and supported.
  1435.  *)
  1436.  
  1437.   DDPCAPS_PRIMARYSURFACE          = $00000010;
  1438.  
  1439. (*
  1440.  * This palette is the one attached to the primary surface left.  Changing
  1441.  * this table has immediate effect on the display for the left eye unless
  1442.  * DDPSETPAL_VSYNC is specified and supported.
  1443.  *)
  1444.  
  1445.   DDPCAPS_PRIMARYSURFACELEFT      = $00000020;
  1446.  
  1447. (*
  1448.  * This palette can have all 256 entries defined
  1449.  *)
  1450.  
  1451.   DDPCAPS_ALLOW256                = $00000040;
  1452.  
  1453. (*
  1454.  * This palette can have modifications to it synced with the monitors
  1455.  * refresh rate.
  1456.  *)
  1457.  
  1458.   DDPCAPS_VSYNC                   = $00000080;
  1459.  
  1460. (*
  1461.  * Index is 1 bit.  There are two color entries in the palette table.
  1462.  *)
  1463.  
  1464.   DDPCAPS_1BIT                    = $00000100;
  1465.  
  1466. (*
  1467.  * Index is 2 bit.  There are four color entries in the palette table.
  1468.  *)
  1469.  
  1470.   DDPCAPS_2BIT                    = $00000200;
  1471.  
  1472.  
  1473. (****************************************************************************
  1474.  *
  1475.  * DIRECTDRAWPALETTE SETENTRY CONSTANTS
  1476.  *
  1477.  ****************************************************************************)
  1478.  
  1479.  
  1480. (****************************************************************************
  1481.  *
  1482.  * DIRECTDRAWPALETTE GETENTRY CONSTANTS
  1483.  *
  1484.  ****************************************************************************)
  1485.  
  1486. (* 0 is the only legal value *)
  1487.  
  1488. (****************************************************************************
  1489.  *
  1490.  * DIRECTDRAWSURFACE SETPALETTE CONSTANTS
  1491.  *
  1492.  ****************************************************************************)
  1493.  
  1494.  
  1495. (****************************************************************************
  1496.  *
  1497.  * DIRECTDRAW BITDEPTH CONSTANTS
  1498.  *
  1499.  * NOTE:  These are only used to indicate supported bit depths.   These
  1500.  * are flags only, they are not to be used as an actual bit depth.   The
  1501.  * absolute numbers 1, 2, 4, 8, 16, 24 and 32 are used to indicate actual
  1502.  * bit depths in a surface or for changing the display mode.
  1503.  *
  1504.  ****************************************************************************)
  1505.  
  1506. (*
  1507.  * 1 bit per pixel.
  1508.  *)
  1509.  
  1510.   DDBD_1                  = $00004000;
  1511.  
  1512. (*
  1513.  * 2 bits per pixel.
  1514.  *)
  1515.  
  1516.   DDBD_2                  = $00002000;
  1517.  
  1518. (*
  1519.  * 4 bits per pixel.
  1520.  *)
  1521.  
  1522.   DDBD_4                  = $00001000;
  1523.  
  1524. (*
  1525.  * 8 bits per pixel.
  1526.  *)
  1527.  
  1528.   DDBD_8                  = $00000800;
  1529.  
  1530. (*
  1531.  * 16 bits per pixel.
  1532.  *)
  1533.  
  1534.   DDBD_16                 = $00000400;
  1535.  
  1536. (*
  1537.  * 24 bits per pixel.
  1538.  *)
  1539.  
  1540.   DDBD_24                 = $00000200;
  1541.  
  1542. (*
  1543.  * 32 bits per pixel.
  1544.  *)
  1545.  
  1546.   DDBD_32                 = $00000100;
  1547.  
  1548. (****************************************************************************
  1549.  *
  1550.  * DIRECTDRAWSURFACE SET/GET COLOR KEY FLAGS
  1551.  *
  1552.  ****************************************************************************)
  1553.  
  1554. (*
  1555.  * Set if the structure contains a color space.  Not set if the structure
  1556.  * contains a single color key.
  1557.  *)
  1558.  
  1559.   DDCKEY_COLORSPACE       = $00000001;
  1560.  
  1561. (*
  1562.  * Set if the structure specifies a color key or color space which is to be
  1563.  * used as a destination color key for blt operations.
  1564.  *)
  1565.  
  1566.   DDCKEY_DESTBLT          = $00000002;
  1567.  
  1568. (*
  1569.  * Set if the structure specifies a color key or color space which is to be
  1570.  * used as a destination color key for overlay operations.
  1571.  *)
  1572.  
  1573.   DDCKEY_DESTOVERLAY      = $00000004;
  1574.  
  1575. (*
  1576.  * Set if the structure specifies a color key or color space which is to be
  1577.  * used as a source color key for blt operations.
  1578.  *)
  1579.  
  1580.   DDCKEY_SRCBLT           = $00000008;
  1581.  
  1582. (*
  1583.  * Set if the structure specifies a color key or color space which is to be
  1584.  * used as a source color key for overlay operations.
  1585.  *)
  1586.  
  1587.   DDCKEY_SRCOVERLAY       = $00000010;
  1588.  
  1589.  
  1590. (****************************************************************************
  1591.  *
  1592.  * DIRECTDRAW COLOR KEY CAPABILITY FLAGS
  1593.  *
  1594.  ****************************************************************************)
  1595.  
  1596. (*
  1597.  * Supports transparent blting using a color key to identify the replaceable 
  1598.  * bits of the destination surface for RGB colors.
  1599.  *)
  1600.  
  1601.   DDCKEYCAPS_DESTBLT                      = $00000001;
  1602.  
  1603. (*
  1604.  * Supports transparent blting using a color space to identify the replaceable
  1605.  * bits of the destination surface for RGB colors.
  1606.  *)
  1607.  
  1608.   DDCKEYCAPS_DESTBLTCLRSPACE              = $00000002;
  1609.  
  1610. (*
  1611.  * Supports transparent blting using a color space to identify the replaceable
  1612.  * bits of the destination surface for YUV colors.
  1613.  *)
  1614.  
  1615.   DDCKEYCAPS_DESTBLTCLRSPACEYUV           = $00000004;
  1616.  
  1617. (*
  1618.  * Supports transparent blting using a color key to identify the replaceable 
  1619.  * bits of the destination surface for YUV colors.
  1620.  *)
  1621.  
  1622.   DDCKEYCAPS_DESTBLTYUV                   = $00000008;
  1623.  
  1624. (*
  1625.  * Supports overlaying using colorkeying of the replaceable bits of the surface
  1626.  * being overlayed for RGB colors.
  1627.  *)
  1628.  
  1629.   DDCKEYCAPS_DESTOVERLAY                  = $00000010;
  1630.  
  1631. (*
  1632.  * Supports a color space as the color key for the destination for RGB colors.
  1633.  *)
  1634.  
  1635.   DDCKEYCAPS_DESTOVERLAYCLRSPACE          = $00000020;
  1636.  
  1637. (*
  1638.  * Supports a color space as the color key for the destination for YUV colors.
  1639.  *)
  1640.  
  1641.   DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV       = $00000040;
  1642.  
  1643. (*
  1644.  * Supports only one active destination color key value for visible overlay
  1645.  * surfaces.
  1646.  *)
  1647.  
  1648.   DDCKEYCAPS_DESTOVERLAYONEACTIVE         = $00000080;
  1649.  
  1650. (*
  1651.  * Supports overlaying using colorkeying of the replaceable bits of the 
  1652.  * surface being overlayed for YUV colors.
  1653.  *)
  1654.  
  1655.   DDCKEYCAPS_DESTOVERLAYYUV               = $00000100;
  1656.  
  1657. (*
  1658.  * Supports transparent blting using the color key for the source with
  1659.  * this surface for RGB colors.
  1660.  *)
  1661.  
  1662.   DDCKEYCAPS_SRCBLT                       = $00000200;
  1663.  
  1664. (*
  1665.  * Supports transparent blting using a color space for the source with
  1666.  * this surface for RGB colors.
  1667.  *)
  1668.  
  1669.   DDCKEYCAPS_SRCBLTCLRSPACE               = $00000400;
  1670.  
  1671. (*
  1672.  * Supports transparent blting using a color space for the source with
  1673.  * this surface for YUV colors.
  1674.  *)
  1675.  
  1676.   DDCKEYCAPS_SRCBLTCLRSPACEYUV            = $00000800;
  1677.  
  1678. (*
  1679.  * Supports transparent blting using the color key for the source with
  1680.  * this surface for YUV colors.
  1681.  *)
  1682.  
  1683.   DDCKEYCAPS_SRCBLTYUV                    = $00001000;
  1684.  
  1685. (*
  1686.  * Supports overlays using the color key for the source with this
  1687.  * overlay surface for RGB colors.
  1688.  *)
  1689.  
  1690.   DDCKEYCAPS_SRCOVERLAY                   = $00002000;
  1691.  
  1692. (*
  1693.  * Supports overlays using a color space as the source color key for
  1694.  * the overlay surface for RGB colors.
  1695.  *)
  1696.  
  1697.   DDCKEYCAPS_SRCOVERLAYCLRSPACE           = $00004000;
  1698.  
  1699. (*
  1700.  * Supports overlays using a color space as the source color key for
  1701.  * the overlay surface for YUV colors.
  1702.  *)
  1703.  
  1704.   DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV        = $00008000;
  1705.  
  1706. (*
  1707.  * Supports only one active source color key value for visible
  1708.  * overlay surfaces.
  1709.  *)
  1710.  
  1711.   DDCKEYCAPS_SRCOVERLAYONEACTIVE          = $00010000;
  1712.  
  1713. (*
  1714.  * Supports overlays using the color key for the source with this
  1715.  * overlay surface for YUV colors.
  1716.  *)
  1717.  
  1718.   DDCKEYCAPS_SRCOVERLAYYUV                = $00020000;
  1719.  
  1720. (*
  1721.  * there are no bandwidth trade-offs for using colorkey with an overlay
  1722.  *)
  1723.  
  1724.   DDCKEYCAPS_NOCOSTOVERLAY                = $00040000;
  1725.  
  1726.  
  1727. (****************************************************************************
  1728.  *
  1729.  * DIRECTDRAW PIXELFORMAT FLAGS
  1730.  *
  1731.  ****************************************************************************)
  1732.  
  1733. (*
  1734.  * The surface has alpha channel information in the pixel format.
  1735.  *)
  1736.  
  1737.   DDPF_ALPHAPIXELS                        = $00000001;
  1738.  
  1739. (*
  1740.  * The pixel format contains alpha only information
  1741.  *)
  1742.  
  1743.   DDPF_ALPHA                              = $00000002;
  1744.  
  1745. (*
  1746.  * The FourCC code is valid.
  1747.  *)
  1748.  
  1749.   DDPF_FOURCC                             = $00000004;
  1750.  
  1751. (*
  1752.  * The surface is 4-bit color indexed.
  1753.  *)
  1754.  
  1755.   DDPF_PALETTEINDEXED4                    = $00000008;
  1756.  
  1757. (*
  1758.  * The surface is indexed into a palette which stores indices
  1759.  * into the destination surface's 8-bit palette.
  1760.  *)
  1761.  
  1762.   DDPF_PALETTEINDEXEDTO8                  = $00000010;
  1763.  
  1764. (*
  1765.  * The surface is 8-bit color indexed.
  1766.  *)
  1767.  
  1768.   DDPF_PALETTEINDEXED8                    = $00000020;
  1769.  
  1770. (*
  1771.  * The RGB data in the pixel format structure is valid.
  1772.  *)
  1773.  
  1774.   DDPF_RGB                                = $00000040;
  1775.  
  1776. (*
  1777.  * The surface will accept pixel data in the format specified
  1778.  * and compress it during the write.
  1779.  *)
  1780.  
  1781.   DDPF_COMPRESSED                         = $00000080;
  1782.  
  1783. (*
  1784.  * The surface will accept RGB data and translate it during
  1785.  * the write to YUV data.  The format of the data to be written
  1786.  * will be contained in the pixel format structure.  The DDPF_RGB
  1787.  * flag will be set. 
  1788.  *)
  1789.  
  1790.   DDPF_RGBTOYUV                           = $00000100;
  1791.  
  1792. (*
  1793.  * pixel format is YUV - YUV data in pixel format struct is valid
  1794.  *)
  1795.  
  1796.   DDPF_YUV                                = $00000200;
  1797.  
  1798. (*
  1799.  * pixel format is a z buffer only surface
  1800.  *)
  1801.  
  1802.   DDPF_ZBUFFER                            = $00000400;
  1803.  
  1804. (*
  1805.  * The surface is 1-bit color indexed.
  1806.  *)
  1807.  
  1808.   DDPF_PALETTEINDEXED1                    = $00000800;
  1809.  
  1810. (*
  1811.  * The surface is 2-bit color indexed.
  1812.  *)
  1813.  
  1814.   DDPF_PALETTEINDEXED2                    = $00001000;
  1815.  
  1816. (*===========================================================================
  1817.  *
  1818.  *
  1819.  * DIRECTDRAW CALLBACK FLAGS
  1820.  *
  1821.  *
  1822.  *==========================================================================*)
  1823.  
  1824. (****************************************************************************
  1825.  *
  1826.  * DIRECTDRAW ENUMSURFACES FLAGS
  1827.  *
  1828.  ****************************************************************************)
  1829.  
  1830. (*
  1831.  * Enumerate all of the surfaces that meet the search criterion.
  1832.  *)
  1833.  
  1834.   DDENUMSURFACES_ALL                      = $00000001;
  1835.  
  1836. (*
  1837.  * A search hit is a surface that matches the surface description.
  1838.  *)
  1839.  
  1840.   DDENUMSURFACES_MATCH                    = $00000002;
  1841.  
  1842. (*
  1843.  * A search hit is a surface that does not match the surface description.
  1844.  *)
  1845.  
  1846.   DDENUMSURFACES_NOMATCH                  = $00000004;
  1847.  
  1848. (*
  1849.  * Enumerate the first surface that can be created which meets the search criterion.
  1850.  *)
  1851.  
  1852.   DDENUMSURFACES_CANBECREATED             = $00000008;
  1853.  
  1854. (*
  1855.  * Enumerate the surfaces that already exist that meet the search criterion.
  1856.  *)
  1857.  
  1858.   DDENUMSURFACES_DOESEXIST                = $00000010;
  1859.  
  1860.  
  1861. (****************************************************************************
  1862.  *
  1863.  * DIRECTDRAW ENUMDISPLAYMODES FLAGS
  1864.  *
  1865.  ****************************************************************************)
  1866.  
  1867. (*
  1868.  * Enumerate Modes with different refresh rates.  EnumDisplayModes guarantees
  1869.  * that a particular mode will be enumerated only once.  This flag specifies whether
  1870.  * the refresh rate is taken into account when determining if a mode is unique.
  1871.  *)
  1872.  
  1873.   DDEDM_REFRESHRATES                      = $00000001;
  1874.  
  1875.  
  1876. (****************************************************************************
  1877.  *
  1878.  * DIRECTDRAW SETCOOPERATIVELEVEL FLAGS
  1879.  *
  1880.  ****************************************************************************)
  1881.  
  1882. (*
  1883.  * Exclusive mode owner will be responsible for the entire primary surface.
  1884.  * GDI can be ignored. used with DD
  1885.  *)
  1886.  
  1887.   DDSCL_FULLSCREEN                        = $00000001;
  1888.  
  1889. (*
  1890.  * allow CTRL_ALT_DEL to work while in fullscreen exclusive mode 
  1891.  *)
  1892.  
  1893.   DDSCL_ALLOWREBOOT                       = $00000002;
  1894.  
  1895. (*
  1896.  * prevents DDRAW from modifying the application window.
  1897.  * prevents DDRAW from minimize/restore the application window on activation.
  1898.  *)
  1899.  
  1900.   DDSCL_NOWINDOWCHANGES                   = $00000004;
  1901.  
  1902. (*
  1903.  * app wants to work as a regular Windows application
  1904.  *)
  1905.  
  1906.   DDSCL_NORMAL                            = $00000008;
  1907.  
  1908. (*
  1909.  * app wants exclusive access
  1910.  *)
  1911.  
  1912.   DDSCL_EXCLUSIVE                         = $00000010;
  1913.  
  1914.  
  1915. (*
  1916.  * app can deal with non-windows display modes
  1917.  *)
  1918.  
  1919.   DDSCL_ALLOWMODEX                        = $00000040;
  1920.  
  1921.  
  1922. (****************************************************************************
  1923.  *
  1924.  * DIRECTDRAW BLT FLAGS
  1925.  *
  1926.  ****************************************************************************)
  1927.  
  1928. (*
  1929.  * Use the alpha information in the pixel format or the alpha channel surface
  1930.  * attached to the destination surface as the alpha channel for this blt.
  1931.  *)
  1932.  
  1933.   DDBLT_ALPHADEST                         = $00000001;
  1934.  
  1935. (*
  1936.  * Use the dwConstAlphaDest field in the DDBLTFX structure as the alpha channel
  1937.  * for the destination surface for this blt.
  1938.  *)
  1939.  
  1940.   DDBLT_ALPHADESTCONSTOVERRIDE            = $00000002;
  1941.  
  1942. (*
  1943.  * The NEG suffix indicates that the destination surface becomes more
  1944.  * transparent as the alpha value increases. (0 is opaque)
  1945.  *)
  1946.  
  1947.   DDBLT_ALPHADESTNEG                      = $00000004;
  1948.  
  1949. (*
  1950.  * Use the lpDDSAlphaDest field in the DDBLTFX structure as the alpha
  1951.  * channel for the destination for this blt.
  1952.  *)
  1953.  
  1954.   DDBLT_ALPHADESTSURFACEOVERRIDE          = $00000008;
  1955.  
  1956. (*
  1957.  * Use the dwAlphaEdgeBlend field in the DDBLTFX structure as the alpha channel
  1958.  * for the edges of the image that border the color key colors.
  1959.  *)
  1960.  
  1961.   DDBLT_ALPHAEDGEBLEND                    = $00000010;
  1962.  
  1963. (*
  1964.  * Use the alpha information in the pixel format or the alpha channel surface
  1965.  * attached to the source surface as the alpha channel for this blt.
  1966.  *)
  1967.  
  1968.   DDBLT_ALPHASRC                          = $00000020;
  1969.  
  1970. (*
  1971.  * Use the dwConstAlphaSrc field in the DDBLTFX structure as the alpha channel
  1972.  * for the source for this blt.
  1973.  *)
  1974.  
  1975.   DDBLT_ALPHASRCCONSTOVERRIDE             = $00000040;
  1976.  
  1977. (*
  1978.  * The NEG suffix indicates that the source surface becomes more transparent
  1979.  * as the alpha value increases. (0 is opaque)
  1980.  *)
  1981.  
  1982.   DDBLT_ALPHASRCNEG                       = $00000080;
  1983.  
  1984. (*
  1985.  * Use the lpDDSAlphaSrc field in the DDBLTFX structure as the alpha channel
  1986.  * for the source for this blt. 
  1987.  *)
  1988.  
  1989.   DDBLT_ALPHASRCSURFACEOVERRIDE           = $00000100;
  1990.  
  1991. (*
  1992.  * Do this blt asynchronously through the FIFO in the order received.  If
  1993.  * there is no room in the hardware FIFO fail the call.
  1994.  *)
  1995.  
  1996.   DDBLT_ASYNC                             = $00000200;
  1997.  
  1998. (*
  1999.  * Uses the dwFillColor field in the DDBLTFX structure as the RGB color
  2000.  * to fill the destination rectangle on the destination surface with.
  2001.  *)
  2002.  
  2003.   DDBLT_COLORFILL                         = $00000400;
  2004.  
  2005. (*
  2006.  * Uses the dwDDFX field in the DDBLTFX structure to specify the effects
  2007.  * to use for the blt.
  2008.  *)
  2009.  
  2010.   DDBLT_DDFX                              = $00000800;
  2011.  
  2012. (*
  2013.  * Uses the dwDDROPS field in the DDBLTFX structure to specify the ROPS
  2014.  * that are not part of the Win32 API.
  2015.  *)
  2016.  
  2017.   DDBLT_DDROPS                            = $00001000;
  2018.  
  2019. (*
  2020.  * Use the color key associated with the destination surface.
  2021.  *)
  2022.  
  2023.   DDBLT_KEYDEST                           = $00002000;
  2024.  
  2025. (*
  2026.  * Use the dckDestColorkey field in the DDBLTFX structure as the color key
  2027.  * for the destination surface.
  2028.  *)
  2029.  
  2030.   DDBLT_KEYDESTOVERRIDE                   = $00004000;
  2031.  
  2032. (*
  2033.  * Use the color key associated with the source surface.
  2034.  *)
  2035.  
  2036.   DDBLT_KEYSRC                            = $00008000;
  2037.  
  2038. (*
  2039.  * Use the dckSrcColorkey field in the DDBLTFX structure as the color key
  2040.  * for the source surface.
  2041.  *)
  2042.  
  2043.   DDBLT_KEYSRCOVERRIDE                    = $00010000;
  2044.  
  2045. (*
  2046.  * Use the dwROP field in the DDBLTFX structure for the raster operation
  2047.  * for this blt.  These ROPs are the same as the ones defined in the Win32 API.
  2048.  *)
  2049.  
  2050.   DDBLT_ROP                               = $00020000;
  2051.  
  2052. (*
  2053.  * Use the dwRotationAngle field in the DDBLTFX structure as the angle
  2054.  * (specified in 1/100th of a degree) to rotate the surface.
  2055.  *)
  2056.  
  2057.   DDBLT_ROTATIONANGLE                     = $00040000;
  2058.  
  2059. (*
  2060.  * Z-buffered blt using the z-buffers attached to the source and destination
  2061.  * surfaces and the dwZBufferOpCode field in the DDBLTFX structure as the
  2062.  * z-buffer opcode.
  2063.  *)
  2064.  
  2065.   DDBLT_ZBUFFER                           = $00080000;
  2066.  
  2067. (*
  2068.  * Z-buffered blt using the dwConstDest Zfield and the dwZBufferOpCode field
  2069.  * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively
  2070.  * for the destination.
  2071.  *)
  2072.  
  2073.   DDBLT_ZBUFFERDESTCONSTOVERRIDE          = $00100000;
  2074.  
  2075. (*
  2076.  * Z-buffered blt using the lpDDSDestZBuffer field and the dwZBufferOpCode
  2077.  * field in the DDBLTFX structure as the z-buffer and z-buffer opcode
  2078.  * respectively for the destination.
  2079.  *)
  2080.  
  2081.   DDBLT_ZBUFFERDESTOVERRIDE               = $00200000;
  2082.  
  2083. (*
  2084.  * Z-buffered blt using the dwConstSrcZ field and the dwZBufferOpCode field
  2085.  * in the DDBLTFX structure as the z-buffer and z-buffer opcode respectively
  2086.  * for the source.
  2087.  *)
  2088.  
  2089.   DDBLT_ZBUFFERSRCCONSTOVERRIDE           = $00400000;
  2090.  
  2091. (*
  2092.  * Z-buffered blt using the lpDDSSrcZBuffer field and the dwZBufferOpCode
  2093.  * field in the DDBLTFX structure as the z-buffer and z-buffer opcode
  2094.  * respectively for the source.
  2095.  *)
  2096.  
  2097.   DDBLT_ZBUFFERSRCOVERRIDE                = $00800000;
  2098.  
  2099. (*
  2100.  * wait until the device is ready to handle the blt
  2101.  * this will cause blt to not return DDERR_WASSTILLDRAWING
  2102.  *)
  2103.  
  2104.   DDBLT_WAIT                              = $01000000;
  2105.  
  2106. (*
  2107.  * Uses the dwFillDepth field in the DDBLTFX structure as the depth value
  2108.  * to fill the destination rectangle on the destination Z-buffer surface
  2109.  * with.
  2110.  *)
  2111.  
  2112.   DDBLT_DEPTHFILL                         = $02000000;
  2113.  
  2114.  
  2115. (****************************************************************************
  2116.  *
  2117.  * BLTFAST FLAGS
  2118.  *
  2119.  ****************************************************************************)
  2120.  
  2121.  
  2122.   DDBLTFAST_NOCOLORKEY                    = $00000000;
  2123.  
  2124.   DDBLTFAST_SRCCOLORKEY                   = $00000001;
  2125.  
  2126.   DDBLTFAST_DESTCOLORKEY                  = $00000002;
  2127.  
  2128.   DDBLTFAST_WAIT                          = $00000010;
  2129.  
  2130. (****************************************************************************
  2131.  *
  2132.  * FLIP FLAGS
  2133.  *
  2134.  ****************************************************************************)
  2135.  
  2136.  
  2137.   DDFLIP_WAIT                          = $00000001;
  2138.  
  2139.  
  2140. (****************************************************************************
  2141.  *
  2142.  * DIRECTDRAW SURFACE OVERLAY FLAGS
  2143.  *
  2144.  ****************************************************************************)
  2145.  
  2146. (*
  2147.  * Use the alpha information in the pixel format or the alpha channel surface
  2148.  * attached to the destination surface as the alpha channel for the
  2149.  * destination overlay.
  2150.  *)
  2151.  
  2152.   DDOVER_ALPHADEST                        = $00000001;
  2153.  
  2154. (*
  2155.  * Use the dwConstAlphaDest field in the DDOVERLAYFX structure as the
  2156.  * destination alpha channel for this overlay.
  2157.  *)
  2158.  
  2159.   DDOVER_ALPHADESTCONSTOVERRIDE           = $00000002;
  2160.  
  2161. (*
  2162.  * The NEG suffix indicates that the destination surface becomes more
  2163.  * transparent as the alpha value increases. 
  2164.  *)
  2165.  
  2166.   DDOVER_ALPHADESTNEG                     = $00000004;
  2167.  
  2168. (*
  2169.  * Use the lpDDSAlphaDest field in the DDOVERLAYFX structure as the alpha
  2170.  * channel destination for this overlay.
  2171.  *)
  2172.  
  2173.   DDOVER_ALPHADESTSURFACEOVERRIDE         = $00000008;
  2174.  
  2175. (*
  2176.  * Use the dwAlphaEdgeBlend field in the DDOVERLAYFX structure as the alpha
  2177.  * channel for the edges of the image that border the color key colors.
  2178.  *)
  2179.  
  2180.   DDOVER_ALPHAEDGEBLEND                   = $00000010;
  2181.  
  2182. (*
  2183.  * Use the alpha information in the pixel format or the alpha channel surface
  2184.  * attached to the source surface as the source alpha channel for this overlay.
  2185.  *)
  2186.  
  2187.   DDOVER_ALPHASRC                         = $00000020;
  2188.  
  2189. (*
  2190.  * Use the dwConstAlphaSrc field in the DDOVERLAYFX structure as the source
  2191.  * alpha channel for this overlay.
  2192.  *)
  2193.  
  2194.   DDOVER_ALPHASRCCONSTOVERRIDE            = $00000040;
  2195.  
  2196. (*
  2197.  * The NEG suffix indicates that the source surface becomes more transparent
  2198.  * as the alpha value increases.
  2199.  *)
  2200.  
  2201.   DDOVER_ALPHASRCNEG                      = $00000080;
  2202.  
  2203. (*
  2204.  * Use the lpDDSAlphaSrc field in the DDOVERLAYFX structure as the alpha channel
  2205.  * source for this overlay.
  2206.  *)
  2207.  
  2208.   DDOVER_ALPHASRCSURFACEOVERRIDE          = $00000100;
  2209.  
  2210. (*
  2211.  * Turn this overlay off.
  2212.  *)
  2213.  
  2214.   DDOVER_HIDE                             = $00000200;
  2215.  
  2216. (*
  2217.  * Use the color key associated with the destination surface.
  2218.  *)
  2219.  
  2220.   DDOVER_KEYDEST                          = $00000400;
  2221.  
  2222. (*
  2223.  * Use the dckDestColorkey field in the DDOVERLAYFX structure as the color key
  2224.  * for the destination surface
  2225.  *)
  2226.  
  2227.   DDOVER_KEYDESTOVERRIDE                  = $00000800;
  2228.  
  2229. (*
  2230.  * Use the color key associated with the source surface.
  2231.  *)
  2232.  
  2233.   DDOVER_KEYSRC                           = $00001000;
  2234.  
  2235. (*
  2236.  * Use the dckSrcColorkey field in the DDOVERLAYFX structure as the color key
  2237.  * for the source surface.
  2238.  *)
  2239.  
  2240.   DDOVER_KEYSRCOVERRIDE                   = $00002000;
  2241.  
  2242. (*
  2243.  * Turn this overlay on.
  2244.  *)
  2245.  
  2246.   DDOVER_SHOW                             = $00004000;
  2247.  
  2248. (*
  2249.  * Add a dirty rect to an emulated overlayed surface.
  2250.  *)
  2251.  
  2252.   DDOVER_ADDDIRTYRECT                     = $00008000;
  2253.  
  2254. (*
  2255.  * Redraw all dirty rects on an emulated overlayed surface.
  2256.  *)
  2257.  
  2258.   DDOVER_REFRESHDIRTYRECTS                = $00010000;
  2259.  
  2260. (*
  2261.  * Redraw the entire surface on an emulated overlayed surface.
  2262.  *)
  2263.  
  2264.   DDOVER_REFRESHALL                      = $00020000;
  2265.  
  2266.  
  2267. (*
  2268.  * Use the overlay FX flags to define special overlay FX
  2269.  *)
  2270.  
  2271.   DDOVER_DDFX                             = $00080000;
  2272.  
  2273.  
  2274. (****************************************************************************
  2275.  *
  2276.  * DIRECTDRAWSURFACE LOCK FLAGS
  2277.  *
  2278.  ****************************************************************************)
  2279.  
  2280. (*
  2281.  * The default.  Set to indicate that Lock should return a valid memory pointer
  2282.  * to the top of the specified rectangle.  If no rectangle is specified then a
  2283.  * pointer to the top of the surface is returned.
  2284.  *)
  2285.  
  2286.   DDLOCK_SURFACEMEMORYPTR                 = $00000000;    // = default
  2287.  
  2288. (*
  2289.  * Set to indicate that Lock should wait until it can obtain a valid memory
  2290.  * pointer before returning.  If this bit is set, Lock will never return 
  2291.  * DDERR_WASSTILLDRAWING.
  2292.  *)
  2293.  
  2294.   DDLOCK_WAIT                             = $00000001;
  2295.  
  2296. (*
  2297.  * Set if an event handle is being passed to Lock.  Lock will trigger the event
  2298.  * when it can return the surface memory pointer requested.
  2299.  *)
  2300.  
  2301.   DDLOCK_EVENT                            = $00000002;
  2302.  
  2303. (*
  2304.  * Indicates that the surface being locked will only be read from.
  2305.  *)
  2306.  
  2307.   DDLOCK_READONLY                         = $00000010;
  2308.  
  2309. (*
  2310.  * Indicates that the surface being locked will only be written to
  2311.  *)
  2312.  
  2313.   DDLOCK_WRITEONLY                        = $00000020;
  2314.  
  2315.  
  2316. (****************************************************************************
  2317.  *
  2318.  * DIRECTDRAWSURFACE PAGELOCK FLAGS
  2319.  *
  2320.  ****************************************************************************)
  2321.  
  2322. (*
  2323.  * No flags defined at present
  2324.  *)
  2325.  
  2326.  
  2327. (****************************************************************************
  2328.  *
  2329.  * DIRECTDRAWSURFACE PAGEUNLOCK FLAGS
  2330.  *
  2331.  ****************************************************************************)
  2332.  
  2333. (*
  2334.  * No flags defined at present
  2335.  *)
  2336.  
  2337.  
  2338. (****************************************************************************
  2339.  *
  2340.  * DIRECTDRAWSURFACE BLT FX FLAGS
  2341.  *
  2342.  ****************************************************************************)
  2343.  
  2344. (*
  2345.  * If stretching, use arithmetic stretching along the Y axis for this blt.
  2346.  *)
  2347.  
  2348.   DDBLTFX_ARITHSTRETCHY                   = $00000001;
  2349.  
  2350. (*
  2351.  * Do this blt mirroring the surface left to right.  Spin the
  2352.  * surface around its y-axis.
  2353.  *)
  2354.  
  2355.   DDBLTFX_MIRRORLEFTRIGHT                 = $00000002;
  2356.  
  2357. (*
  2358.  * Do this blt mirroring the surface up and down.  Spin the surface
  2359.  * around its x-axis.
  2360.  *)
  2361.  
  2362.   DDBLTFX_MIRRORUPDOWN                    = $00000004;
  2363.  
  2364. (*
  2365.  * Schedule this blt to avoid tearing.
  2366.  *)
  2367.  
  2368.   DDBLTFX_NOTEARING                       = $00000008;
  2369.  
  2370. (*
  2371.  * Do this blt rotating the surface one hundred and eighty degrees.
  2372.  *)
  2373.  
  2374.   DDBLTFX_ROTATE180                       = $00000010;
  2375.  
  2376. (*
  2377.  * Do this blt rotating the surface two hundred and seventy degrees.
  2378.  *)
  2379.  
  2380.   DDBLTFX_ROTATE270                       = $00000020;
  2381.  
  2382. (*
  2383.  * Do this blt rotating the surface ninety degrees.
  2384.  *)
  2385.  
  2386.   DDBLTFX_ROTATE90                        = $00000040;
  2387.  
  2388. (*
  2389.  * Do this z blt using dwZBufferLow and dwZBufferHigh as  range values
  2390.  * specified to limit the bits copied from the source surface.
  2391.  *)
  2392.  
  2393.   DDBLTFX_ZBUFFERRANGE                    = $00000080;
  2394.  
  2395. (*
  2396.  * Do this z blt adding the dwZBufferBaseDest to each of the sources z values
  2397.  * before comparing it with the desting z values.
  2398.  *)
  2399.  
  2400.   DDBLTFX_ZBUFFERBASEDEST                 = $00000100;
  2401.  
  2402. (****************************************************************************
  2403.  *
  2404.  * DIRECTDRAWSURFACE OVERLAY FX FLAGS
  2405.  *
  2406.  ****************************************************************************)
  2407.  
  2408. (*
  2409.  * If stretching, use arithmetic stretching along the Y axis for this overlay.
  2410.  *)
  2411.  
  2412.   DDOVERFX_ARITHSTRETCHY                  = $00000001;
  2413.  
  2414. (*
  2415.  * Mirror the overlay across the vertical axis
  2416.  *)
  2417.  
  2418.   DDOVERFX_MIRRORLEFTRIGHT                = $00000002;
  2419.  
  2420. (*
  2421.  * Mirror the overlay across the horizontal axis
  2422.  *)
  2423.  
  2424.   DDOVERFX_MIRRORUPDOWN                   = $00000004;
  2425.  
  2426. (****************************************************************************
  2427.  *
  2428.  * DIRECTDRAW WAITFORVERTICALBLANK FLAGS
  2429.  *
  2430.  ****************************************************************************)
  2431.  
  2432. (*
  2433.  * return when the vertical blank interval begins
  2434.  *)
  2435.  
  2436.   DDWAITVB_BLOCKBEGIN                     = $00000001;
  2437.  
  2438. (*
  2439.  * set up an event to trigger when the vertical blank begins
  2440.  *)
  2441.  
  2442.   DDWAITVB_BLOCKBEGINEVENT                = $00000002;
  2443.  
  2444. (*
  2445.  * return when the vertical blank interval ends and display begins
  2446.  *)
  2447.  
  2448.   DDWAITVB_BLOCKEND                       = $00000004;
  2449.  
  2450. (****************************************************************************
  2451.  *
  2452.  * DIRECTDRAW GETFLIPSTATUS FLAGS
  2453.  *
  2454.  ****************************************************************************)
  2455.  
  2456. (*
  2457.  * is it OK to flip now?
  2458.  *)
  2459.  
  2460.   DDGFS_CANFLIP                   = $00000001;
  2461.  
  2462. (*
  2463.  * is the last flip finished?
  2464.  *)
  2465.  
  2466.   DDGFS_ISFLIPDONE                = $00000002;
  2467.  
  2468. (****************************************************************************
  2469.  *
  2470.  * DIRECTDRAW GETBLTSTATUS FLAGS
  2471.  *
  2472.  ****************************************************************************)
  2473.  
  2474. (*
  2475.  * is it OK to blt now?
  2476.  *)
  2477.  
  2478.   DDGBS_CANBLT                    = $00000001;
  2479.  
  2480. (*
  2481.  * is the blt to the surface finished?
  2482.  *)
  2483.  
  2484.   DDGBS_ISBLTDONE                 = $00000002;
  2485.  
  2486.  
  2487. (****************************************************************************
  2488.  *
  2489.  * DIRECTDRAW ENUMOVERLAYZORDER FLAGS
  2490.  *
  2491.  ****************************************************************************)
  2492.  
  2493. (*
  2494.  * Enumerate overlays back to front.
  2495.  *)
  2496.  
  2497.   DDENUMOVERLAYZ_BACKTOFRONT      = $00000000;
  2498.  
  2499. (*
  2500.  * Enumerate overlays front to back
  2501.  *)
  2502.  
  2503.   DDENUMOVERLAYZ_FRONTTOBACK      = $00000001;
  2504.  
  2505. (****************************************************************************
  2506.  *
  2507.  * DIRECTDRAW UPDATEOVERLAYZORDER FLAGS
  2508.  *
  2509.  ****************************************************************************)
  2510.  
  2511. (*
  2512.  * Send overlay to front
  2513.  *)
  2514.  
  2515.   DDOVERZ_SENDTOFRONT             = $00000000;
  2516.  
  2517. (*
  2518.  * Send overlay to back
  2519.  *)
  2520.  
  2521.   DDOVERZ_SENDTOBACK              = $00000001;
  2522.  
  2523. (*
  2524.  * Move Overlay forward
  2525.  *)
  2526.  
  2527.   DDOVERZ_MOVEFORWARD             = $00000002;
  2528.  
  2529. (*
  2530.  * Move Overlay backward
  2531.  *)
  2532.  
  2533.   DDOVERZ_MOVEBACKWARD            = $00000003;
  2534.  
  2535. (*
  2536.  * Move Overlay in front of relative surface
  2537.  *)
  2538.  
  2539.   DDOVERZ_INSERTINFRONTOF         = $00000004;
  2540.  
  2541. (*
  2542.  * Move Overlay in back of relative surface
  2543.  *)
  2544.  
  2545.   DDOVERZ_INSERTINBACKOF          = $00000005;
  2546.  
  2547. (*===========================================================================
  2548.  *
  2549.  *
  2550.  * DIRECTDRAW RETURN CODES
  2551.  *
  2552.  * The return values from DirectDraw Commands and Surface that return an HRESULT
  2553.  * are codes from DirectDraw concerning the results of the action
  2554.  * requested by DirectDraw.
  2555.  *
  2556.  *==========================================================================*)
  2557.  
  2558. (*
  2559.  * Status is OK
  2560.  *
  2561.  * Issued by: DirectDraw Commands and all callbacks
  2562.  *)
  2563.  
  2564.   DD_OK                                   = 0;
  2565.  
  2566. (****************************************************************************
  2567.  *
  2568.  * DIRECTDRAW ENUMCALLBACK RETURN VALUES
  2569.  *
  2570.  * EnumCallback returns are used to control the flow of the DIRECTDRAW and
  2571.  * DIRECTDRAWSURFACE object enumerations.   They can only be returned by
  2572.  * enumeration callback routines.
  2573.  *
  2574.  ****************************************************************************)
  2575.  
  2576. (*
  2577.  * stop the enumeration
  2578.  *)
  2579.  
  2580.   DDENUMRET_CANCEL                        = 0;
  2581.  
  2582. (*
  2583.  * continue the enumeration
  2584.  *)
  2585.  
  2586.   DDENUMRET_OK                            = 1;
  2587.  
  2588. (****************************************************************************
  2589.  *
  2590.  * DIRECTDRAW ERRORS
  2591.  *
  2592.  * Errors are represented by negative values and cannot be combined.
  2593.  *
  2594.  ****************************************************************************)
  2595.  
  2596. (*
  2597.  * This object is already initialized
  2598.  *)
  2599.   DDERR_ALREADYINITIALIZED                = $88760000 + 5;
  2600.  
  2601. (*
  2602.  * This surface can not be attached to the requested surface.
  2603.  *)
  2604.   DDERR_CANNOTATTACHSURFACE               = $88760000 + 10;
  2605.  
  2606. (*
  2607.  * This surface can not be detached from the requested surface.
  2608.  *)
  2609.   DDERR_CANNOTDETACHSURFACE               = $88760000 + 20;
  2610.  
  2611. (*
  2612.  * Support is currently not available.
  2613.  *)
  2614.   DDERR_CURRENTLYNOTAVAIL                 = $88760000 + 40;
  2615.  
  2616. (*
  2617.  * An exception was encountered while performing the requested operation
  2618.  *)
  2619.   DDERR_EXCEPTION                         = $88760000 + 55;
  2620.  
  2621. (*
  2622.  * Generic failure.
  2623.  *)
  2624.  
  2625.   DDERR_GENERIC                           = E_FAIL;
  2626.  
  2627. (*
  2628.  * Height of rectangle provided is not a multiple of reqd alignment
  2629.  *)
  2630.   DDERR_HEIGHTALIGN                       = $88760000 + 90;
  2631.  
  2632. (*
  2633.  * Unable to match primary surface creation request with existing
  2634.  * primary surface.
  2635.  *)
  2636.   DDERR_INCOMPATIBLEPRIMARY               = $88760000 + 95;
  2637.  
  2638. (*
  2639.  * One or more of the caps bits passed to the callback are incorrect.
  2640.  *)
  2641.   DDERR_INVALIDCAPS                       = $88760000 + 100;
  2642.  
  2643. (*
  2644.  * DirectDraw does not support provided Cliplist.
  2645.  *)
  2646.  
  2647.   DDERR_INVALIDCLIPLIST                   = $88760000 + 110;
  2648.  
  2649. (*
  2650.  * DirectDraw does not support the requested mode
  2651.  *)
  2652.  
  2653.   DDERR_INVALIDMODE                       = $88760000 + 120;
  2654.  
  2655. (*
  2656.  * DirectDraw received a pointer that was an invalid DIRECTDRAW object.
  2657.  *)
  2658.  
  2659.   DDERR_INVALIDOBJECT                     = $88760000 + 130;
  2660.  
  2661. (*
  2662.  * One or more of the parameters passed to the callback function are
  2663.  * incorrect.
  2664.  *)
  2665.  
  2666.  
  2667.   DDERR_INVALIDPARAMS                     = E_INVALIDARG;
  2668.  
  2669. (*
  2670.  * pixel format was invalid as specified
  2671.  *)
  2672.  
  2673.   DDERR_INVALIDPIXELFORMAT                = $88760000 + 145;
  2674.  
  2675. (*
  2676.  * Rectangle provided was invalid.
  2677.  *)
  2678.  
  2679.   DDERR_INVALIDRECT                       = $88760000 + 150;
  2680.  
  2681. (*
  2682.  * Operation could not be carried out because one or more surfaces are locked
  2683.  *)
  2684.  
  2685.   DDERR_LOCKEDSURFACES                    = $88760000 + 160;
  2686.  
  2687. (*
  2688.  * There is no 3D present.
  2689.  *)
  2690.  
  2691.   DDERR_NO3D                              = $88760000 + 170;
  2692.  
  2693. (*
  2694.  * Operation could not be carried out because there is no alpha accleration
  2695.  * hardware present or available.
  2696.  *)
  2697.  
  2698.   DDERR_NOALPHAHW                         = $88760000 + 180;
  2699.  
  2700.  
  2701. (*
  2702.  * no clip list available
  2703.  *)
  2704.  
  2705.   DDERR_NOCLIPLIST                        = $88760000 + 205;
  2706.  
  2707. (*
  2708.  * Operation could not be carried out because there is no color conversion
  2709.  * hardware present or available.
  2710.  *)
  2711.  
  2712.   DDERR_NOCOLORCONVHW                     = $88760000 + 210;
  2713.  
  2714. (*
  2715.  * Create function called without DirectDraw object method SetCooperativeLevel
  2716.  * being called.
  2717.  *)
  2718.  
  2719.   DDERR_NOCOOPERATIVELEVELSET             = $88760000 + 212;
  2720.  
  2721. (*
  2722.  * Surface doesn't currently have a color key
  2723.  *)
  2724.  
  2725.   DDERR_NOCOLORKEY                        = $88760000 + 215;
  2726.  
  2727. (*
  2728.  * Operation could not be carried out because there is no hardware support
  2729.  * of the dest color key.
  2730.  *)
  2731.  
  2732.   DDERR_NOCOLORKEYHW                      = $88760000 + 220;
  2733.  
  2734. (*
  2735.  * No DirectDraw support possible with current display driver
  2736.  *)
  2737.  
  2738.   DDERR_NODIRECTDRAWSUPPORT               = $88760000 + 222;
  2739.  
  2740. (*
  2741.  * Operation requires the application to have exclusive mode but the
  2742.  * application does not have exclusive mode.
  2743.  *)
  2744.  
  2745.   DDERR_NOEXCLUSIVEMODE                   = $88760000 + 225;
  2746.  
  2747. (*
  2748.  * Flipping visible surfaces is not supported.
  2749.  *)
  2750.  
  2751.   DDERR_NOFLIPHW                          = $88760000 + 230;
  2752.  
  2753. (*
  2754.  * There is no GDI present.
  2755.  *)
  2756.  
  2757.   DDERR_NOGDI                             = $88760000 + 240;
  2758.  
  2759. (*
  2760.  * Operation could not be carried out because there is no hardware present
  2761.  * or available.
  2762.  *)
  2763.  
  2764.   DDERR_NOMIRRORHW                        = $88760000 + 250;
  2765.  
  2766. (*
  2767.  * Requested item was not found
  2768.  *)
  2769.  
  2770.   DDERR_NOTFOUND                          = $88760000 + 255;
  2771.  
  2772. (*
  2773.  * Operation could not be carried out because there is no overlay hardware
  2774.  * present or available.
  2775.  *)
  2776.  
  2777.   DDERR_NOOVERLAYHW                       = $88760000 + 260;
  2778.  
  2779. (*
  2780.  * Operation could not be carried out because there is no appropriate raster
  2781.  * op hardware present or available.
  2782.  *)
  2783.  
  2784.   DDERR_NORASTEROPHW                      = $88760000 + 280;
  2785.  
  2786. (*
  2787.  * Operation could not be carried out because there is no rotation hardware
  2788.  * present or available.
  2789.  *)
  2790.  
  2791.   DDERR_NOROTATIONHW                      = $88760000 + 290;
  2792.  
  2793. (*
  2794.  * Operation could not be carried out because there is no hardware support
  2795.  * for stretching
  2796.  *)
  2797.  
  2798.   DDERR_NOSTRETCHHW                       = $88760000 + 310;
  2799.  
  2800. (*
  2801.  * DirectDrawSurface is not in 4 bit color palette and the requested operation
  2802.  * requires 4 bit color palette.
  2803.  *)
  2804.  
  2805.   DDERR_NOT4BITCOLOR                      = $88760000 + 316;
  2806.  
  2807. (*
  2808.  * DirectDrawSurface is not in 4 bit color index palette and the requested
  2809.  * operation requires 4 bit color index palette.
  2810.  *)
  2811.  
  2812.   DDERR_NOT4BITCOLORINDEX                 = $88760000 + 317;
  2813.  
  2814. (*
  2815.  * DirectDraw Surface is not in 8 bit color mode and the requested operation
  2816.  * requires 8 bit color.
  2817.  *)
  2818.  
  2819.   DDERR_NOT8BITCOLOR                      = $88760000 + 320;
  2820.  
  2821. (*
  2822.  * Operation could not be carried out because there is no texture mapping
  2823.  * hardware present or available.
  2824.  *)
  2825.  
  2826.   DDERR_NOTEXTUREHW                       = $88760000 + 330;
  2827.  
  2828. (*
  2829.  * Operation could not be carried out because there is no hardware support
  2830.  * for vertical blank synchronized operations.
  2831.  *)
  2832.  
  2833.   DDERR_NOVSYNCHW                         = $88760000 + 335;
  2834.  
  2835. (*
  2836.  * Operation could not be carried out because there is no hardware support
  2837.  * for zbuffer blting.
  2838.  *)
  2839.  
  2840.   DDERR_NOZBUFFERHW                       = $88760000 + 340;
  2841.  
  2842. (*
  2843.  * Overlay surfaces could not be z layered based on their BltOrder because
  2844.  * the hardware does not support z layering of overlays.
  2845.  *)
  2846.  
  2847.   DDERR_NOZOVERLAYHW                      = $88760000 + 350;
  2848.  
  2849. (*
  2850.  * The hardware needed for the requested operation has already been
  2851.  * allocated.
  2852.  *)
  2853.  
  2854.   DDERR_OUTOFCAPS                         = $88760000 + 360;
  2855.  
  2856. (*
  2857.  * DirectDraw does not have enough memory to perform the operation.
  2858.  *)
  2859.  
  2860.  
  2861.   DDERR_OUTOFMEMORY                       = E_OUTOFMEMORY;
  2862.  
  2863. (*
  2864.  * DirectDraw does not have enough memory to perform the operation.
  2865.  *)
  2866.  
  2867.   DDERR_OUTOFVIDEOMEMORY                  = $88760000 + 380;
  2868.  
  2869. (*
  2870.  * hardware does not support clipped overlays
  2871.  *)
  2872.  
  2873.   DDERR_OVERLAYCANTCLIP                   = $88760000 + 382;
  2874.  
  2875. (*
  2876.  * Can only have ony color key active at one time for overlays
  2877.  *)
  2878.  
  2879.   DDERR_OVERLAYCOLORKEYONLYONEACTIVE      = $88760000 + 384;
  2880.  
  2881. (*
  2882.  * Access to this palette is being refused because the palette is already
  2883.  * locked by another thread.
  2884.  *)
  2885.  
  2886.   DDERR_PALETTEBUSY                       = $88760000 + 387;
  2887.  
  2888. (*
  2889.  * No src color key specified for this operation.
  2890.  *)
  2891.  
  2892.   DDERR_COLORKEYNOTSET                    = $88760000 + 400;
  2893.  
  2894. (*
  2895.  * This surface is already attached to the surface it is being attached to.
  2896.  *)
  2897.  
  2898.   DDERR_SURFACEALREADYATTACHED            = $88760000 + 410;
  2899.  
  2900. (*
  2901.  * This surface is already a dependency of the surface it is being made a
  2902.  * dependency of.
  2903.  *)
  2904.  
  2905.   DDERR_SURFACEALREADYDEPENDENT           = $88760000 + 420;
  2906.  
  2907. (*
  2908.  * Access to this surface is being refused because the surface is already
  2909.  * locked by another thread.
  2910.  *)
  2911.  
  2912.   DDERR_SURFACEBUSY                       = $88760000 + 430;
  2913.  
  2914. (*
  2915.  * Access to this surface is being refused because no driver exists
  2916.  * which can supply a pointer to the surface.
  2917.  * This is most likely to happen when attempting to lock the primary
  2918.  * surface when no DCI provider is present.
  2919.  *)
  2920.  
  2921.   DDERR_CANTLOCKSURFACE                   = $88760000 + 435;
  2922.  
  2923. (*
  2924.  * Access to Surface refused because Surface is obscured.
  2925.  *)
  2926.  
  2927.   DDERR_SURFACEISOBSCURED                 = $88760000 + 440;
  2928.  
  2929. (*
  2930.  * Access to this surface is being refused because the surface is gone.
  2931.  * The DIRECTDRAWSURFACE object representing this surface should
  2932.  * have Restore called on it.
  2933.  *)
  2934.  
  2935.   DDERR_SURFACELOST                       = $88760000 + 450;
  2936.  
  2937. (*
  2938.  * The requested surface is not attached.
  2939.  *)
  2940.  
  2941.   DDERR_SURFACENOTATTACHED                = $88760000 + 460;
  2942.  
  2943. (*
  2944.  * Height requested by DirectDraw is too large.
  2945.  *)
  2946.  
  2947.   DDERR_TOOBIGHEIGHT                      = $88760000 + 470;
  2948.  
  2949. (*
  2950.  * Size requested by DirectDraw is too large --  The individual height and
  2951.  * width are OK.
  2952.  *)
  2953.  
  2954.   DDERR_TOOBIGSIZE                        = $88760000 + 480;
  2955.  
  2956. (*
  2957.  * Width requested by DirectDraw is too large.
  2958.  *)
  2959.  
  2960.   DDERR_TOOBIGWIDTH                       = $88760000 + 490;
  2961.  
  2962. (*
  2963.  * Action not supported.
  2964.  *)
  2965.  
  2966.  
  2967.   DDERR_UNSUPPORTED                       = E_NOTIMPL;
  2968.  
  2969. (*
  2970.  * FOURCC format requested is unsupported by DirectDraw
  2971.  *)
  2972.  
  2973.   DDERR_UNSUPPORTEDFORMAT                 = $88760000 + 510;
  2974.  
  2975. (*
  2976.  * Bitmask in the pixel format requested is unsupported by DirectDraw
  2977.  *)
  2978.  
  2979.   DDERR_UNSUPPORTEDMASK                   = $88760000 + 520;
  2980.  
  2981. (*
  2982.  * vertical blank is in progress
  2983.  *)
  2984.  
  2985.   DDERR_VERTICALBLANKINPROGRESS           = $88760000 + 537;
  2986.  
  2987. (*
  2988.  * Informs DirectDraw that the previous Blt which is transfering information
  2989.  * to or from this Surface is incomplete.
  2990.  *)
  2991.  
  2992.   DDERR_WASSTILLDRAWING                   = $88760000 + 540;
  2993.  
  2994. (*
  2995.  * Rectangle provided was not horizontally aligned on reqd. boundary
  2996.  *)
  2997.  
  2998.   DDERR_XALIGN                            = $88760000 + 560;
  2999.  
  3000. (*
  3001.  * The GUID passed to DirectDrawCreate is not a valid DirectDraw driver
  3002.  * identifier.
  3003.  *)
  3004.  
  3005.   DDERR_INVALIDDIRECTDRAWGUID             = $88760000 + 561;
  3006.  
  3007. (*
  3008.  * A DirectDraw object representing this driver has already been created
  3009.  * for this process.
  3010.  *)
  3011.  
  3012.   DDERR_DIRECTDRAWALREADYCREATED          = $88760000 + 562;
  3013.  
  3014. (*
  3015.  * A hardware only DirectDraw object creation was attempted but the driver
  3016.  * did not support any hardware.
  3017.  *)
  3018.  
  3019.   DDERR_NODIRECTDRAWHW                    = $88760000 + 563;
  3020.  
  3021. (*
  3022.  * this process already has created a primary surface
  3023.  *)
  3024.  
  3025.   DDERR_PRIMARYSURFACEALREADYEXISTS       = $88760000 + 564;
  3026.  
  3027. (*
  3028.  * software emulation not available.
  3029.  *)
  3030.  
  3031.   DDERR_NOEMULATION                       = $88760000 + 565;
  3032.  
  3033. (*
  3034.  * region passed to Clipper::GetClipList is too small.
  3035.  *)
  3036.  
  3037.   DDERR_REGIONTOOSMALL                    = $88760000 + 566;
  3038.  
  3039. (*
  3040.  * an attempt was made to set a clip list for a clipper objec that
  3041.  * is already monitoring an hwnd.
  3042.  *)
  3043.  
  3044.   DDERR_CLIPPERISUSINGHWND                = $88760000 + 567;
  3045.  
  3046. (*
  3047.  * No clipper object attached to surface object
  3048.  *)
  3049.  
  3050.   DDERR_NOCLIPPERATTACHED                 = $88760000 + 568;
  3051.  
  3052. (*
  3053.  * Clipper notification requires an HWND or
  3054.  * no HWND has previously been set as the CooperativeLevel HWND.
  3055.  *)
  3056.  
  3057.   DDERR_NOHWND                            = $88760000 + 569;
  3058.  
  3059. (*
  3060.  * HWND used by DirectDraw CooperativeLevel has been subclassed,
  3061.  * this prevents DirectDraw from restoring state.
  3062.  *)
  3063.  
  3064.   DDERR_HWNDSUBCLASSED                    = $88760000 + 570;
  3065.  
  3066. (*
  3067.  * The CooperativeLevel HWND has already been set.
  3068.  * It can not be reset while the process has surfaces or palettes created.
  3069.  *)
  3070.  
  3071.   DDERR_HWNDALREADYSET                    = $88760000 + 571;
  3072.  
  3073. (*
  3074.  * No palette object attached to this surface.
  3075.  *)
  3076.  
  3077.   DDERR_NOPALETTEATTACHED                 = $88760000 + 572;
  3078.  
  3079. (*
  3080.  * No hardware support for 16 or 256 color palettes.
  3081.  *)
  3082.  
  3083.   DDERR_NOPALETTEHW                       = $88760000 + 573;
  3084.  
  3085. (*
  3086.  * If a clipper object is attached to the source surface passed into a
  3087.  * BltFast call.
  3088.  *)
  3089.  
  3090.   DDERR_BLTFASTCANTCLIP                   = $88760000 + 574;
  3091.  
  3092. (*
  3093.  * No blter.
  3094.  *)
  3095.  
  3096.   DDERR_NOBLTHW                           = $88760000 + 575;
  3097.  
  3098. (*
  3099.  * No DirectDraw ROP hardware.
  3100.  *)
  3101.  
  3102.   DDERR_NODDROPSHW                        = $88760000 + 576;
  3103.  
  3104. (*
  3105.  * returned when GetOverlayPosition is called on a hidden overlay
  3106.  *)
  3107.  
  3108.   DDERR_OVERLAYNOTVISIBLE                 = $88760000 + 577;
  3109.  
  3110. (*
  3111.  * returned when GetOverlayPosition is called on a overlay that UpdateOverlay
  3112.  * has never been called on to establish a destionation.
  3113.  *)
  3114.  
  3115.   DDERR_NOOVERLAYDEST                     = $88760000 + 578;
  3116.  
  3117. (*
  3118.  * returned when the position of the overlay on the destionation is no longer
  3119.  * legal for that destionation.
  3120.  *)
  3121.  
  3122.   DDERR_INVALIDPOSITION                   = $88760000 + 579;
  3123.  
  3124. (*
  3125.  * returned when an overlay member is called for a non-overlay surface
  3126.  *)
  3127.  
  3128.   DDERR_NOTAOVERLAYSURFACE                = $88760000 + 580;
  3129.  
  3130. (*
  3131.  * An attempt was made to set the cooperative level when it was already
  3132.  * set to exclusive.
  3133.  *)
  3134.  
  3135.   DDERR_EXCLUSIVEMODEALREADYSET           = $88760000 + 581;
  3136.  
  3137. (*
  3138.  * An attempt has been made to flip a surface that is not flippable.
  3139.  *)
  3140.  
  3141.   DDERR_NOTFLIPPABLE                      = $88760000 + 582;
  3142.  
  3143. (*
  3144.  * Can't duplicate primary & 3D surfaces, or surfaces that are implicitly
  3145.  * created.
  3146.  *)
  3147.  
  3148.   DDERR_CANTDUPLICATE                     = $88760000 + 583;
  3149.  
  3150. (*
  3151.  * Surface was not locked.  An attempt to unlock a surface that was not
  3152.  * locked at all, or by this process, has been attempted.
  3153.  *)
  3154.  
  3155.   DDERR_NOTLOCKED                         = $88760000 + 584;
  3156.  
  3157. (*
  3158.  * Windows can not create any more DCs
  3159.  *)
  3160.  
  3161.   DDERR_CANTCREATEDC                      = $88760000 + 585;
  3162.  
  3163. (*
  3164.  * No DC was ever created for this surface.
  3165.  *)
  3166.  
  3167.   DDERR_NODC                              = $88760000 + 586;
  3168.  
  3169. (*
  3170.  * This surface can not be restored because it was created in a different
  3171.  * mode.
  3172.  *)
  3173.  
  3174.   DDERR_WRONGMODE                         = $88760000 + 587;
  3175.  
  3176. (*
  3177.  * This surface can not be restored because it is an implicitly created
  3178.  * surface.
  3179.  *)
  3180.  
  3181.   DDERR_IMPLICITLYCREATED                 = $88760000 + 588;
  3182.  
  3183. (*
  3184.  * The surface being used is not a palette-based surface
  3185.  *)
  3186.  
  3187.   DDERR_NOTPALETTIZED                     = $88760000 + 589;
  3188.  
  3189. (*
  3190.  * The display is currently in an unsupported mode
  3191.  *)
  3192.  
  3193.   DDERR_UNSUPPORTEDMODE                   = $88760000 + 590;
  3194.  
  3195. (*
  3196.  * Operation could not be carried out because there is no mip-map
  3197.  * texture mapping hardware present or available.
  3198.  *)
  3199.  
  3200.   DDERR_NOMIPMAPHW                        = $88760000 + 591;
  3201.  
  3202. (*
  3203.  * The requested action could not be performed because the surface was of
  3204.  * the wrong type.
  3205.  *)
  3206.  
  3207.   DDERR_INVALIDSURFACETYPE                = $88760000 + 592;
  3208.  
  3209. (*
  3210.  * A DC has already been returned for this surface. Only one DC can be
  3211.  * retrieved per surface.
  3212.  *)
  3213.  
  3214.   DDERR_DCALREADYCREATED                  = $88760000 + 620;
  3215.  
  3216. (*
  3217.  * The attempt to page lock a surface failed.
  3218.  *)
  3219.  
  3220.   DDERR_CANTPAGELOCK                      = $88760000 + 640;
  3221.  
  3222. (*
  3223.  * The attempt to page unlock a surface failed.
  3224.  *)
  3225.  
  3226.   DDERR_CANTPAGEUNLOCK                    = $88760000 + 660;
  3227.  
  3228. (*
  3229.  * An attempt was made to page unlock a surface with no outstanding page locks.
  3230.  *)
  3231.  
  3232.   DDERR_NOTPAGELOCKED                     = $88760000 + 680;
  3233.  
  3234. (*
  3235.  * An attempt was made to invoke an interface member of a DirectDraw object
  3236.  * created by CoCreateInstance() before it was initialized.
  3237.  *)
  3238.  
  3239.   DDERR_NOTINITIALIZED                    = CO_E_NOTINITIALIZED;
  3240.  
  3241. type
  3242.   TDDENUMCALLBACK = function (const GUID: TGUID; DriverDescription: PChar;
  3243.       lpDriverName: PChar; lpContext: Pointer): BOOL; stdcall;
  3244.  
  3245. const
  3246.   REGSTR_KEY_DDHW_DESCRIPTION = 'Description';
  3247.   REGSTR_KEY_DDHW_DRIVERNAME  = 'DriverName';
  3248.   REGSTR_PATH_DDHW            = 'Hardware\DirectDrawDrivers';
  3249.  
  3250.   DDCREATE_HARDWAREONLY       = $00000001;
  3251.   DDCREATE_EMULATIONONLY      = $00000002;
  3252.  
  3253. function DirectDrawEnumerate (lpCallback: TDDENUMCALLBACK;
  3254.     lpContext: Pointer): HRESULT; stdcall;
  3255.  
  3256. //  begin *NTR 4/2/97
  3257.  
  3258. (*
  3259.   function DirectDrawCreate (const GUID: TGUID; out DD: IDirectDraw;
  3260.     pUnkOuter: IUnknown): HRESULT; stdcall;
  3261.  
  3262.   HRESULT DirectDrawCreate(
  3263.     GUID FAR * lpGUID,
  3264.     LPDIRECTDRAW FAR *lplpDD,
  3265.     IUnknown FAR *pUnkOuter )
  3266. *)
  3267.  
  3268. function DirectDrawCreate (const GUID: PGUID; out DD: IDirectDraw;
  3269.     pUnkOuter: IUnknown): HRESULT; stdcall;
  3270. //  end NTR 4/2/97
  3271.  
  3272. function DirectDrawCreateClipper (dwFlags: DWORD;
  3273.     out DDClipper: IDirectDrawClipper; const pUnkOuter: IUnknown): HRESULT; stdcall;
  3274. function NtDirectDrawCreate (const GUID: TGUID; var lplpDD: THandle;
  3275.     const pUnkOuter: IUnknown): HRESULT; stdcall;
  3276.  
  3277.  
  3278. { --------------- Direct Play ---------------- }
  3279.  
  3280. (*
  3281.  * This flag is set on the EnumSessions callback dwFlags parameter when
  3282.  * the time out has occurred. There will be no session data for this
  3283.  * callback. If *lpdwTimeOut is set to a non-zero value and the
  3284.  * EnumSessionsCallback function returns TRUE then EnumSessions will
  3285.  * continue waiting until the next timeout occurs. Timeouts are in
  3286.  * milliseconds.
  3287.  *)
  3288. const
  3289.   DPESC_TIMEDOUT          = $00000001;
  3290.  
  3291. (****************************************************************************
  3292.  *
  3293.  * DirectPlay Structures
  3294.  *
  3295.  * Various structures used to invoke DirectPlay.
  3296.  *
  3297.  ****************************************************************************)
  3298.  
  3299. type
  3300.   IDirectPlay2 = interface;
  3301.   IDirectPlay2A = interface;
  3302.  
  3303. (*
  3304.  * DPID
  3305.  * DirectPlay player and group ID
  3306.  *)
  3307.  
  3308.   DPID = DWORD;
  3309.   PDPID = ^DPID;
  3310.  
  3311. (*
  3312.  * DPCAPS
  3313.  * Used to obtain the capabilities of a DirectPlay object
  3314.  *)
  3315.  
  3316.   TDPCAPS = record
  3317.     dwSize: DWORD;             // Size of structure, in bytes
  3318.     dwFlags: DWORD;            // DPCAPS_xxx flags
  3319.     dwMaxBufferSize: DWORD;    // Maximum message size, in bytes,  for this service provider
  3320.     dwMaxQueueSize: DWORD;     // Obsolete.
  3321.     dwMaxPlayers: DWORD;       // Maximum players/groups (local + remote)
  3322.     dwHundredBaud: DWORD;      // Bandwidth in 100 bits per second units;
  3323.                                 // i.e. 24 is 2400, 96 is 9600, etc.
  3324.     dwLatency: DWORD;          // Estimated latency; 0 = unknown
  3325.     dwMaxLocalPlayers: DWORD;  // Maximum # of locally created players allowed
  3326.     dwHeaderLength: DWORD;     // Maximum header length, in bytes, on messages
  3327.                                 // added by the service provider
  3328.     dwTimeout: DWORD;          // Service provider's suggested timeout value
  3329.                                 // This is how long DirectPlay will wait for
  3330.                                 // responses to system messages
  3331.   end;
  3332.   PDPCAPS = ^TDPCAPS;
  3333.  
  3334. (*
  3335.  * DPSESSIONDESC2
  3336.  * Used to describe the properties of a DirectPlay
  3337.  * session instance
  3338.  *)
  3339.   TDPSESSIONDESC2 = record
  3340.     dwSize: DWORD;             // Size of structure
  3341.     dwFlags: DWORD;            // DPSESSION_xxx flags
  3342.     guidInstance: TGUID;       // ID for the session instance
  3343.     guidApplication: TGUID;    // GUID of the DirectPlay application.
  3344.                                 // GUID_NULL for all applications.
  3345.     dwMaxPlayers: DWORD;       // Maximum # players allowed in session
  3346.     dwCurrentPlayers: DWORD;   // Current # players in session (read only)
  3347.     lpszSessionNameA: PChar;   // Name of the session
  3348.     lpszPasswordA: PChar;      // Password of the session (optional)
  3349.     dwReserved1: DWORD;        // Reserved for future MS use.
  3350.     dwReserved2: DWORD;
  3351.     dwUser1: DWORD;            // For use by the application
  3352.     dwUser2: DWORD;
  3353.     dwUser3: DWORD;
  3354.     dwUser4: DWORD;
  3355.   end;
  3356.   PDPSESSIONDESC2 = ^TDPSESSIONDESC2;
  3357.  
  3358. (*
  3359.  * LPCDPSESSIONDESC2
  3360.  * A constant pointer to DPSESSIONDESC2
  3361.  *)
  3362. // typedef const DPSESSIONDESC2 FAR *LPCDPSESSIONDESC2;
  3363.  
  3364. (*
  3365.  * DPNAME
  3366.  * Used to hold the name of a DirectPlay entity
  3367.  * like a player or a group
  3368.  *)
  3369.  
  3370.   TDPNAME = record
  3371.     dwSize: DWORD;             // Size of structure
  3372.     dwFlags: DWORD;            // Not used. Must be zero.
  3373.     lpszShortName: PChar;      // The short or friendly name
  3374.     lpszLongName: PChar;       // The long or formal name
  3375.   end;
  3376.   PDPNAME = ^TDPNAME;
  3377.  
  3378. (*
  3379.  * LPCDPNAME
  3380.  * A constant pointer to DPNAME
  3381.  *)
  3382. // typedef const DPNAME FAR *LPCDPNAME;
  3383.  
  3384.  
  3385. (****************************************************************************
  3386.  *
  3387.  * Prototypes for DirectPlay callback functions
  3388.  *
  3389.  ****************************************************************************)
  3390.  
  3391. (*
  3392.  * Callback for IDirectPlay2::EnumSessions
  3393.  *)
  3394.   TDPENUMSESSIONSCALLBACK2 = function (const lpThisSD: TDPSESSIONDESC2;
  3395.       var lpdwTimeOut: DWORD; dwFlags: DWORD; lpContext: Pointer): BOOL;
  3396.       stdcall;
  3397.  
  3398. (*
  3399.  * Callback for IDirectPlay2::EnumPlayers
  3400.  *              IDirectPlay2::EnumGroups
  3401.  *              IDirectPlay2::EnumGroupPlayers
  3402.  *)
  3403.  
  3404.   TDPENUMPLAYERSCALLBACK2 = function (dpId: DPID; dwPlayerType: DWORD;
  3405.       const lpName: TDPNAME; dwFlags: DWORD; lpContext: Pointer): BOOL;
  3406.       stdcall;
  3407.  
  3408. (*
  3409.  * Unicode callback for DirectPlayEnumerate
  3410.  *)
  3411.   TDPENUMDPCALLBACKW = function (var lpguidSP: TGUID; lpSPName: PWideChar;
  3412.       dwMajorVersion, dwMinorVersion: DWORD; lpContext: Pointer): BOOL;
  3413.       stdcall;
  3414.  
  3415. (*
  3416.  * ANSI callback for DirectPlayEnumerate
  3417.  *)
  3418.   TDPENUMDPCALLBACKA = function (var lpguidSP: TGUID; lpSPName: PChar;
  3419.       dwMajorVersion, dwMinorVersion: DWORD; lpContext: Pointer): BOOL;
  3420.       stdcall;
  3421.  
  3422.   TDPENUMDPCALLBACK = TDPENUMDPCALLBACKA;
  3423.  
  3424. (****************************************************************************
  3425.  *
  3426.  * IDirectPlay2 (and IDirectPlay2A) Interface
  3427.  *
  3428.  ****************************************************************************)
  3429.  
  3430.   IDirectPlay2 = interface (IUnknown)
  3431.     ['{2b74f7c0-9154-11cf-a9cd-00aa006886e3}']
  3432.     function AddPlayerToGroup (idGroup, idPlayer: DPID): HRESULT; stdcall;
  3433.     function Close: HRESULT; stdcall;
  3434.     function CreateGroup (var lpidGroup: DPID; var lpGroupName: TDPNAME;
  3435.         lpData: Pointer; dwDataSize, dwFlags: DWORD): HRESULT; stdcall;
  3436.     function CreatePlayer (var  lpidPlayer: DPID; var lpPlayerName: TDPNAME;
  3437.         hEvent: THANDLE; lpData: Pointer; dwDataSize,
  3438.         dwFlags: DWORD): HRESULT; stdcall;
  3439.     function DeletePlayerFromGroup (idGroup, idPlayer: DPID): HRESULT; stdcall;
  3440.     function DestroyGroup (idGroup: DPID): HRESULT; stdcall;
  3441.     function DestroyPlayer (idPlayer: DPID): HRESULT; stdcall;
  3442.     function EnumGroupPlayers (idGroup: DPID; const lpguidInstance: TGUID;
  3443.         EnumPlayersCallback2: TDPENUMPLAYERSCALLBACK2; lpContext: Pointer;
  3444.         dwFlags: DWORD): HRESULT; stdcall;
  3445.     function EnumGroups (const lpguidInstance: TGUID;
  3446.         lpEnumPlayersCallback2: TDPENUMPLAYERSCALLBACK2; lpContext: Pointer;
  3447.         dwFlags: DWORD): HRESULT; stdcall;
  3448.     function EnumPlayers (const lpguidInstance: TGUID;
  3449.         lpEnumPlayersCallback2: TDPENUMPLAYERSCALLBACK2; lpContext: Pointer;
  3450.         dwFlags: DWORD): HRESULT; stdcall;
  3451.     function EnumSessions (var lpsd: TDPSESSIONDESC2; dwTimeout: DWORD;
  3452.         lpEnumSessionsCallback2: TDPENUMSESSIONSCALLBACK2; lpContext: Pointer;
  3453.         dwFlags: DWORD): HRESULT; stdcall;
  3454.     function GetCaps (var lpDPCaps: TDPCAPS;
  3455.         dwFlags: DWORD): HRESULT; stdcall;
  3456.     function GetGroupData (idGroup: DPID; lpData: Pointer;
  3457.         var lpdwDataSize: DWORD; dwFlags: DWORD): HRESULT; stdcall;
  3458.     function GetGroupName (idGroup: DPID; lpData: Pointer;
  3459.         var lpdwDataSize: DWORD): HRESULT; stdcall;
  3460.     function GetMessageCount (idPlayer: DPID;
  3461.         var lpdwCount: DWORD): HRESULT; stdcall;
  3462.     function GetPlayerAddress (idPlayer: DPID; lpAddress: Pointer;
  3463.         var lpdwAddressSize: DWORD): HRESULT; stdcall;
  3464.     function GetPlayerCaps (idPlayer: DPID; var lpPlayerCaps: TDPCAPS;
  3465.         dwFlags: DWORD): HRESULT; stdcall;
  3466.     function GetPlayerData (idPlayer: DPID; lpData: Pointer;
  3467.         var lpdwDataSize: DWORD; dwFlags: DWORD): HRESULT; stdcall;
  3468.     function GetPlayerName (idPlayer: DPID; lpData: Pointer;
  3469.         var lpdwDataSize: DWORD): HRESULT; stdcall;
  3470.     function GetSessionDesc (lpData: Pointer;
  3471.         var lpdwDataSize: DWORD): HRESULT; stdcall;
  3472.     function Initialize (const GUID: TGUID): HRESULT; stdcall;
  3473.     function Open (var lpsd: TDPSESSIONDESC2;
  3474.         dwFlags: DWORD): HRESULT; stdcall;
  3475.     function Receive (var lpidFrom, lpidTo: DPID; dwFlags: DWORD;
  3476.         lpData: Pointer; var lpdwDataSize: DWORD): HRESULT; stdcall;
  3477.     function Send (idFrom, idTo: DPID; dwFlags: DWORD; lpData: Pointer;
  3478.         dwDataSize: DWORD): HRESULT; stdcall;
  3479.     function SetGroupData (idGroup: DPID; lpData: Pointer;
  3480.         dwDataSize: DWORD; dwFlags: DWORD): HRESULT; stdcall;
  3481.     function SetGroupName (idGroup: DPID; var lpGroupName: TDPNAME;
  3482.         dwFlags: DWORD): HRESULT; stdcall;
  3483.     function SetPlayerData (idPlayer: DPID; lpData: Pointer; dwDataSize,
  3484.         dwFlags: DWORD): HRESULT; stdcall;
  3485.     function SetPlayerName (idPlayer: DPID; var lpPlayerName: TDPNAME;
  3486.         dwFlags: DWORD): HRESULT; stdcall;
  3487.     function SetSessionDesc (var lpSessDesc: TDPSESSIONDESC2;
  3488.         dwFlags: DWORD): HRESULT; stdcall;
  3489.   end;
  3490.  
  3491.   IDirectPlay2A = interface(IDirectPlay2)
  3492.     ['{9d460580-a822-11cf-960c-0080c7534e82}']
  3493.   end;
  3494.  
  3495. (*
  3496.  * DPID that system messages come from
  3497.  *)
  3498.  
  3499. const
  3500.   DPID_SYSMSG         = 0;
  3501.  
  3502. (*
  3503.  * DPID representing all players in the session
  3504.  *)
  3505.  
  3506.   DPID_ALLPLAYERS     = 0;
  3507.  
  3508. (*
  3509.  * This DirectPlay object is the session host.  If the host exits the
  3510.  * session, another application will become the host and receive a
  3511.  * DPSYS_HOST system message.
  3512.  *)
  3513.   DPCAPS_ISHOST               = $00000002;
  3514.  
  3515. (*
  3516.  * The service provider bound to this DirectPlay object can optimize
  3517.  * group messaging.
  3518.  *)
  3519.   DPCAPS_GROUPOPTIMIZED       = $00000008;
  3520.  
  3521. (*
  3522.  * The service provider bound to this DirectPlay object can optimize
  3523.  * keep alives (see DPSESSION_KEEPALIVE)
  3524.  *)
  3525.   DPCAPS_KEEPALIVEOPTIMIZED   = $00000010;
  3526.  
  3527. (*
  3528.  * The service provider bound to this DirectPlay object can optimize
  3529.  * guaranteed message delivery.
  3530.  *)
  3531.   DPCAPS_GUARANTEEDOPTIMIZED  = $00000020;
  3532.  
  3533. (*
  3534.  * This DirectPlay object supports guaranteed message delivery.
  3535.  *)
  3536.   DPCAPS_GUARANTEEDSUPPORTED  = $00000040;
  3537.  
  3538. (*
  3539.  * Applications cannot create new players in this session.
  3540.  *)
  3541.   DPSESSION_NEWPLAYERSDISABLED    = $00000001;
  3542.  
  3543. (*
  3544.  * If the DirectPlay object that created the session, the host,
  3545.  * quits, then the host will attempt to migrate to another
  3546.  * DirectPlay object so that new players can continue to be created
  3547.  * and new applications can join the session.
  3548.  *)
  3549.   DPSESSION_MIGRATEHOST           = $00000004;
  3550.  
  3551. (*
  3552.  * This flag tells DirectPlay not to set the idPlayerTo and idPlayerFrom
  3553.  * fields in player messages.  This cuts two DWORD's off the message
  3554.  * overhead.
  3555.  *)
  3556.   DPSESSION_NOMESSAGEID           = $00000008;
  3557.  
  3558.  
  3559. (*
  3560.  * This flag tells DirectPlay to not allow any new applications to
  3561.  * join the session.  Applications already in the session can still
  3562.  * create new players.
  3563.  *)
  3564.   DPSESSION_JOINDISABLED          = $00000020;
  3565.  
  3566. (*
  3567.  * This flag tells DirectPlay to detect when remote players
  3568.  * exit abnormally (e.g. their computer or modem gets unplugged)
  3569.  *)
  3570.   DPSESSION_KEEPALIVE             = $00000040;
  3571.  
  3572. (*
  3573.  * This flag tells DirectPlay not to send a message to all players
  3574.  *      when a players remote data changes
  3575.  *)
  3576.   DPSESSION_NODATAMESSAGES        = $00000080;
  3577.  
  3578.  (****************************************************************************
  3579.  *
  3580.  * EnumPlayers API flags
  3581.  *
  3582.  ****************************************************************************)
  3583.  
  3584. (*
  3585.  * Enumerate all players in the current session
  3586.  *)
  3587.   DPENUMPLAYERS_ALL           = $00000000;
  3588.  
  3589. (*
  3590.  * Enumerate only local (created by this application) players
  3591.  *)
  3592.   DPENUMPLAYERS_LOCAL         = $00000008;
  3593.  
  3594. (*
  3595.  * Enumerate only remote (non-local) players
  3596.  *)
  3597.   DPENUMPLAYERS_REMOTE        = $00000010;
  3598.  
  3599. (*
  3600.  * Enumerate groups along with the players
  3601.  *)
  3602.   DPENUMPLAYERS_GROUP         = $00000020;
  3603.  
  3604. (*
  3605.  * Enumerate players in another session (must supply lpguidInstance)
  3606.  *)
  3607.   DPENUMPLAYERS_SESSION       = $00000080;
  3608.  
  3609.  
  3610. (****************************************************************************
  3611.  *
  3612.  * EnumSessions API flags
  3613.  *
  3614.  ****************************************************************************)
  3615.  
  3616. (*
  3617.  * Enumerate sessions which can be joined
  3618.  *)
  3619.   DPENUMSESSIONS_AVAILABLE    = $00000001;
  3620.  
  3621. (*
  3622.  * Enumerate all sessions even if they can't be joined.
  3623.  *)
  3624.   DPENUMSESSIONS_ALL          = $00000002;
  3625.  
  3626.  
  3627. (****************************************************************************
  3628.  *
  3629.  * GetCaps and GetPlayerCaps API flags
  3630.  *
  3631.  ****************************************************************************)
  3632.  
  3633. (*
  3634.  * The latency returned should be for guaranteed message sending.
  3635.  * Default is non-guaranteed messaging.
  3636.  *)
  3637.   DPGETCAPS_GUARANTEED        = $00000001;
  3638.  
  3639.  
  3640. (****************************************************************************
  3641.  *
  3642.  * GetGroupData, GetPlayerData API flags
  3643.  * Remote and local Group/Player data is maintained separately.
  3644.  * Default is DPGET_REMOTE.
  3645.  *
  3646.  ****************************************************************************)
  3647.  
  3648. (*
  3649.  * Get the remote data (set by any DirectPlay object in
  3650.  * the session using DPSET_REMOTE)
  3651.  *)
  3652.   DPGET_REMOTE                = $00000000;
  3653.  
  3654. (*
  3655.  * Get the local data (set by this DirectPlay object
  3656.  * using DPSET_LOCAL)
  3657.  *)
  3658.   DPGET_LOCAL                 = $00000001;
  3659.  
  3660.  
  3661. (****************************************************************************
  3662.  *
  3663.  * Open API flags
  3664.  *
  3665.  ****************************************************************************)
  3666.  
  3667. (*
  3668.  * Join the session that is described by the DPSESSIONDESC2 structure
  3669.  *)
  3670.   DPOPEN_JOIN                 = $00000001;
  3671.  
  3672. (*
  3673.  * Create a new session as described by the DPSESSIONDESC2 structure
  3674.  *)
  3675.   DPOPEN_CREATE               = $00000002;
  3676.  
  3677. (****************************************************************************
  3678.  *
  3679.  * Receive API flags
  3680.  * Default is DPRECEIVE_ALL
  3681.  *
  3682.  ****************************************************************************)
  3683.  
  3684. (*
  3685.  * Get the first message in the queue
  3686.  *)
  3687.   DPRECEIVE_ALL               = $00000001;
  3688.  
  3689. (*
  3690.  * Get the first message in the queue directed to a specific player
  3691.  *)
  3692.   DPRECEIVE_TOPLAYER          = $00000002;
  3693.  
  3694. (*
  3695.  * Get the first message in the queue from a specific player
  3696.  *)
  3697.   DPRECEIVE_FROMPLAYER        = $00000004;
  3698.  
  3699. (*
  3700.  * Get the message but don't remove it from the queue
  3701.  *)
  3702.   DPRECEIVE_PEEK              = $00000008;
  3703.  
  3704.  
  3705. (****************************************************************************
  3706.  *
  3707.  * Send API flags
  3708.  *
  3709.  ****************************************************************************)
  3710.  
  3711. (*
  3712.  * Send the message using a guaranteed send method.
  3713.  * Default is non-guaranteed.
  3714.  *)
  3715.   DPSEND_GUARANTEED           = $00000001;
  3716.  
  3717. (*
  3718.  * Send the message high-priority. Move to front of
  3719.  * send queue of sender and the receive queue of the
  3720.  * receipient
  3721.  *)
  3722.   DPSEND_HIGHPRIORITY         = $00000002;
  3723.  
  3724. (*
  3725.  * Application will be sending several more guaranteed messages to
  3726.  * this player so the service provider may want to optimize for this.
  3727.  * Implementation of this flag by a service provider is optional.
  3728.  *)
  3729.   DPSEND_OPENSTREAM           = $00000008;
  3730.  
  3731. (*
  3732.  * The optimization requested by DPSEND_OPENSTREAM is no longer
  3733.  * needed.  Resources allocated for DPSEND_OPENSTREAM may be released.
  3734.  *)
  3735.   DPSEND_CLOSESTREAM          = $00000010;
  3736.  
  3737.  
  3738. (****************************************************************************
  3739.  *
  3740.  * SetGroupData, SetGroupName, SetPlayerData, SetPlayerName,
  3741.  * SetSessionDesc API flags.
  3742.  * Default is DPSET_REMOTE.
  3743.  *
  3744.  ****************************************************************************)
  3745.  
  3746. (* 
  3747.  * Propagate the data to all players in the session
  3748.  *)
  3749.   DPSET_REMOTE                = $00000000;
  3750.  
  3751. (*
  3752.  * Do not propagate the data to other players
  3753.  *)
  3754.   DPSET_LOCAL                 = $00000001;
  3755.  
  3756. (*
  3757.  * Used with DPSET_REMOTE, use guaranteed message send to
  3758.  * propagate the data
  3759.  *)
  3760.   DPSET_GUARANTEED            = $00000002;
  3761.  
  3762.  
  3763. (****************************************************************************
  3764.  *
  3765.  * DirectPlay system messages and message data structures
  3766.  *
  3767.  * All system message come 'From' player DPID_SYSMSG.  To determine what type 
  3768.  * of message it is, cast the lpData from Receive to DPMSG_GENERIC and check
  3769.  * the dwType member against one of the following DPSYS_xxx constants. Once
  3770.  * a match is found, cast the lpData to the corresponding of the DPMSG_xxx
  3771.  * structures to access the data of the message.
  3772.  *
  3773.  ****************************************************************************)
  3774.  
  3775. (*
  3776.  * A new player or group has been created in the session
  3777.  * Use DPMSG_CREATEPLAYERORGROUP.  Check dwPlayerType to see if it
  3778.  * is a player or a group.
  3779.  *)
  3780.   DPSYS_CREATEPLAYERORGROUP   = $0003;  
  3781.  
  3782. (*
  3783.  * A player has been deleted from the session
  3784.  * Use DPMSG_DESTROYPLAYERORGROUP
  3785.  *)
  3786.   DPSYS_DESTROYPLAYERORGROUP  = $0005;  
  3787.  
  3788. (*
  3789.  * A player has been added to a group
  3790.  * Use DPMSG_ADDPLAYERTOGROUP
  3791.  *)
  3792.   DPSYS_ADDPLAYERTOGROUP      = $0007;  
  3793.  
  3794. (*
  3795.  * A player has been removed from a group
  3796.  * Use DPMSG_DELETEPLAYERFROMGROUP
  3797.  *)
  3798.   DPSYS_DELETEPLAYERFROMGROUP = $0021;  
  3799.  
  3800. (*
  3801.  * This DirectPlay object lost its connection with all the
  3802.  * other players in the session.
  3803.  * Use DPMSG_SESSIONLOST.
  3804.  *)
  3805.   DPSYS_SESSIONLOST           = $0031;
  3806.  
  3807. (*
  3808.  * The current host has left the session.
  3809.  * This DirectPlay object is now the host.
  3810.  * Use DPMSG_HOST.
  3811.  *)
  3812.   DPSYS_HOST                  = $0101;
  3813.  
  3814. (*
  3815.  * The remote data associated with a player or
  3816.  * group has changed. Check dwPlayerType to see
  3817.  * if it is a player or a group
  3818.  * Use DPMSG_SETPLAYERORGROUPDATA
  3819.  *)
  3820.   DPSYS_SETPLAYERORGROUPDATA  = $0102;
  3821.  
  3822. (*
  3823.  * The name of a player or group has changed.
  3824.  * Check dwPlayerType to see if it is a player
  3825.  * or a group.
  3826.  * Use DPMSG_SETPLAYERORGROUPNAME
  3827.  *)
  3828.   DPSYS_SETPLAYERORGROUPNAME  = $0103;
  3829.  
  3830. (*
  3831.  * Used in the dwPlayerType field to indicate if it applies to a group
  3832.  * or a player
  3833.  *)
  3834.   DPPLAYERTYPE_GROUP          = $00000000;
  3835.   DPPLAYERTYPE_PLAYER         = $00000001;
  3836.  
  3837. (*
  3838.  * DPMSG_GENERIC
  3839.  * Generic message structure used to identify the message type.
  3840.  *)
  3841. type
  3842.   TDPMSG_GENERIC = record
  3843.     dwType: DWORD;             // Message type
  3844.   end;
  3845.   PDPMSG_GENERIC = ^TDPMSG_GENERIC;
  3846.  
  3847. (*
  3848.  * DPMSG_CREATEPLAYERORGROUP
  3849.  * System message generated when a new player or group
  3850.  * created in the session with information about it.
  3851.  *)
  3852.   TDPMSG_CREATEPLAYERORGROUP = record
  3853.     dwType: DWORD;             // Message type
  3854.     dwPlayerType: DWORD;       // Is it a player or group
  3855.     dpId: DPID;                // ID of the player or group
  3856.     dwCurrentPlayers: DWORD;   // current # players & groups in session
  3857.     lpData: Pointer;           // pointer to remote data
  3858.     dwDataSize: DWORD;         // size of remote data
  3859.     dpnName: TDPNAME;           // structure with name info
  3860.   end;
  3861.   PDPMSG_CREATEPLAYERORGROUP = ^TDPMSG_CREATEPLAYERORGROUP;
  3862.  
  3863. (*
  3864.  * DPMSG_DESTROYPLAYERORGROUP
  3865.  * System message generated when a player or group is being
  3866.  * destroyed in the session with information about it.
  3867.  *)
  3868.   TDPMSG_DESTROYPLAYERORGROUP = record
  3869.     dwType: DWORD;             // Message type
  3870.     dwPlayerType: DWORD;       // Is it a player or group
  3871.     dpId: DPID;                // player ID being deleted
  3872.     lpLocalData: Pointer;      // copy of players local data
  3873.     dwLocalDataSize: DWORD;    // sizeof local data
  3874.     lpRemoteData: Pointer;     // copy of players remote data
  3875.     dwRemoteDataSize: DWORD;   // sizeof remote data
  3876.   end;
  3877.   PDPMSG_DESTROYPLAYERORGROUP = ^TDPMSG_DESTROYPLAYERORGROUP;
  3878.  
  3879. (*
  3880.  * DPMSG_ADDPLAYERTOGROUP
  3881.  * System message generated when a player is being added
  3882.  * to a group.
  3883.  *)
  3884.   TDPMSG_ADDPLAYERTOGROUP = record
  3885.     dwType: DWORD;             // Message type
  3886.     dpIdGroup: DPID;           // group ID being added to
  3887.     dpIdPlayer: DPID;          // player ID being added
  3888.   end;
  3889.   PDPMSG_ADDPLAYERTOGROUP = ^TDPMSG_ADDPLAYERTOGROUP;
  3890.  
  3891. (*
  3892.  * DPMSG_DELETEPLAYERFROMGROUP
  3893.  * System message generated when a player is being
  3894.  * removed from a group
  3895.  *)
  3896.   TDPMSG_DELETEPLAYERFROMGROUP = TDPMSG_ADDPLAYERTOGROUP;
  3897.   PDPMSG_DELETEPLAYERFROMGROUP = ^TDPMSG_DELETEPLAYERFROMGROUP;
  3898.  
  3899. (*
  3900.  * DPMSG_SETPLAYERORGROUPDATA
  3901.  * System message generated when remote data for a player or
  3902.  * group has changed.
  3903.  *)
  3904.   TDPMSG_SETPLAYERORGROUPDATA = record
  3905.     dwType: DWORD;             // Message type
  3906.     dwPlayerType: DWORD;       // Is it a player or group
  3907.     dpId: DPID;                // ID of player or group
  3908.     lpData: Pointer;           // pointer to remote data
  3909.     dwDataSize: DWORD;         // size of remote data
  3910.   end;
  3911.   PDPMSG_SETPLAYERORGROUPDATA = ^TDPMSG_SETPLAYERORGROUPDATA;
  3912.  
  3913. (*
  3914.  * DPMSG_SETPLAYERORGROUPNAME
  3915.  * System message generated when the name of a player or
  3916.  * group has changed.
  3917.  *)
  3918.   TDPMSG_SETPLAYERORGROUPNAME = record
  3919.     dwType: DWORD;             // Message type
  3920.     dwPlayerType: DWORD;       // Is it a player or group
  3921.     dpId: DPID;                // ID of player or group
  3922.     dpnName: TDPNAME;           // structure with new name info
  3923.   end;
  3924.   PDPMSG_SETPLAYERORGROUPNAME = ^TDPMSG_SETPLAYERORGROUPNAME;
  3925.  
  3926. (*
  3927.  * DPMSG_HOST
  3928.  * System message generated when the host has migrated to this
  3929.  * DirectPlay object.
  3930.  *
  3931.  *)
  3932.   TDPMSG_HOST = TDPMSG_GENERIC;
  3933.   PDPMSG_HOST = ^TDPMSG_HOST;
  3934.  
  3935. (*
  3936.  * DPMSG_SESSIONLOST
  3937.  * System message generated when the connection to the session is lost.
  3938.  *
  3939.  *)
  3940.   TDPMSG_SESSIONLOST = TDPMSG_GENERIC;
  3941.   PDPMSG_SESSIONLOST = ^TDPMSG_SESSIONLOST;
  3942.  
  3943. (****************************************************************************
  3944.  *
  3945.  * DIRECTPLAY ERRORS
  3946.  *
  3947.  * Errors are represented by negative values and cannot be combined.
  3948.  *
  3949.  ****************************************************************************)
  3950.  
  3951. const
  3952.   DP_OK                           = S_OK;
  3953.   DPERR_ALREADYINITIALIZED        = $88770000 + 5;
  3954.   DPERR_ACCESSDENIED              = $88770000 + 10;
  3955.   DPERR_ACTIVEPLAYERS             = $88770000 + 20;
  3956.   DPERR_BUFFERTOOSMALL            = $88770000 + 30;
  3957.   DPERR_CANTADDPLAYER             = $88770000 + 40;
  3958.   DPERR_CANTCREATEGROUP           = $88770000 + 50;
  3959.   DPERR_CANTCREATEPLAYER          = $88770000 + 60;
  3960.   DPERR_CANTCREATESESSION         = $88770000 + 70;
  3961.   DPERR_CAPSNOTAVAILABLEYET       = $88770000 + 80;
  3962.   DPERR_EXCEPTION                 = $88770000 + 90;
  3963.   DPERR_GENERIC                   = E_FAIL;
  3964.   DPERR_INVALIDFLAGS              = $88770000 + 120;
  3965.   DPERR_INVALIDOBJECT             = $88770000 + 130;
  3966.   DPERR_INVALIDPARAM              = E_INVALIDARG;
  3967.   DPERR_INVALIDPARAMS             = DPERR_INVALIDPARAM;
  3968.   DPERR_INVALIDPLAYER             = $88770000 + 150;
  3969.   DPERR_NOCAPS                    = $88770000 + 160;
  3970.   DPERR_NOCONNECTION              = $88770000 + 170;
  3971.   DPERR_NOMEMORY                  = E_OUTOFMEMORY;
  3972.   DPERR_OUTOFMEMORY               = DPERR_NOMEMORY;
  3973.   DPERR_NOMESSAGES                = $88770000 + 190;
  3974.   DPERR_NONAMESERVERFOUND         = $88770000 + 200;
  3975.   DPERR_NOPLAYERS                 = $88770000 + 210;
  3976.   DPERR_NOSESSIONS                = $88770000 + 220;
  3977.   DPERR_SENDTOOBIG                = $88770000 + 230;
  3978.   DPERR_TIMEOUT                   = $88770000 + 240;
  3979.   DPERR_UNAVAILABLE               = $88770000 + 250;
  3980.   DPERR_UNSUPPORTED               = E_NOTIMPL;
  3981.   DPERR_BUSY                      = $88770000 + 270;
  3982.   DPERR_USERCANCEL                = $88770000 + 280;
  3983.   DPERR_NOINTERFACE               = E_NOINTERFACE;
  3984.   DPERR_CANNOTCREATESERVER        = $88770000 + 290;
  3985.   DPERR_PLAYERLOST                = $88770000 + 300;
  3986.   DPERR_SESSIONLOST               = $88770000 + 310;
  3987.  
  3988.   DPERR_BUFFERTOOLARGE            = $88770000 + 1000;
  3989.   DPERR_CANTCREATEPROCESS         = $88770000 + 1010;
  3990.   DPERR_APPNOTSTARTED             = $88770000 + 1020;
  3991.   DPERR_INVALIDINTERFACE          = $88770000 + 1030;
  3992.   DPERR_NOSERVICEPROVIDER         = $88770000 + 1040;
  3993.   DPERR_UNKNOWNAPPLICATION        = $88770000 + 1050;
  3994.   DPERR_NOTLOBBIED                = $88770000 + 1070;
  3995.  
  3996.  
  3997. (****************************************************************************
  3998.  *
  3999.  *      dplay 1.0 obsolete structures + interfaces
  4000.  *      Included for compatibility only. New apps should
  4001.  *      use IDirectPlay2
  4002.  *
  4003.  ****************************************************************************)
  4004. const
  4005.   DPOPEN_OPENSESSION          = DPOPEN_JOIN;
  4006.   DPOPEN_CREATESESSION        = DPOPEN_CREATE;
  4007.  
  4008.   DPENUMSESSIONS_PREVIOUS     = $00000004;
  4009.  
  4010.   DPENUMPLAYERS_PREVIOUS      = $00000004;
  4011.  
  4012.   DPSEND_GUARANTEE            = DPSEND_GUARANTEED;
  4013.   DPSEND_TRYONCE              = $00000004;
  4014.  
  4015.   DPCAPS_NAMESERVICE          = $00000001;
  4016.   DPCAPS_NAMESERVER           = DPCAPS_ISHOST;
  4017.   DPCAPS_GUARANTEED           = $00000004;
  4018.  
  4019.   DPLONGNAMELEN               = 52;
  4020.   DPSHORTNAMELEN              = 20;
  4021.   DPSESSIONNAMELEN            = 32;
  4022.   DPPASSWORDLEN               = 16;
  4023.   DPUSERRESERVED              = 16;
  4024.  
  4025.   DPSYS_ADDPLAYER             = $0003;
  4026.   DPSYS_DELETEPLAYER          = $0005;
  4027.  
  4028.   DPSYS_DELETEGROUP           = $0020;
  4029.   DPSYS_DELETEPLAYERFROMGRP   = $0021;
  4030.   DPSYS_CONNECT               = $484b;
  4031.  
  4032. type
  4033.   IDirectPlay = interface;
  4034.  
  4035.   TDPMSG_ADDPLAYER = packed record
  4036.     dwType: DWORD;
  4037.     dwPlayerType: DWORD;
  4038.     dpId: DPID;
  4039.     szLongName: Array [ 0..DPLONGNAMELEN-1 ] of char;
  4040.     szShortName: Array [ 0..DPSHORTNAMELEN-1 ] of char;
  4041.     dwCurrentPlayers: DWORD;
  4042.   end;
  4043.   TDPMSG_ADDGROUP = TDPMSG_ADDPLAYER;
  4044.  
  4045.   TDPMSG_GROUPADD = record
  4046.     dwType: DWORD;
  4047.     dpIdGroup: DPID;
  4048.     dpIdPlayer: DPID;
  4049.   end;
  4050.   TDPMSG_GROUPDELETE = TDPMSG_GROUPADD;
  4051.  
  4052.   TDPMSG_DELETEPLAYER = record
  4053.     dwType: DWORD;
  4054.     dpId: DPID;
  4055.   end;
  4056.  
  4057.   TDPENUMPLAYERSCALLBACK = function (dpId: DPID; lpFriendlyName: PChar;
  4058.       lpFormalName: PChar; dwFlags: DWORD; lpContext: Pointer): BOOL;
  4059.       stdcall;
  4060.  
  4061.   TDPSESSIONDESC = record
  4062.     dwSize: DWORD;
  4063.     guidSession: TGUID;
  4064.     dwSession: DWORD;
  4065.     dwMaxPlayers: DWORD;
  4066.     dwCurrentPlayers: DWORD;
  4067.     dwFlags: DWORD;
  4068.     szSessionName: Array [ 0..DPSESSIONNAMELEN-1 ] of char;
  4069.     szUserField: Array [ 0..DPUSERRESERVED-1 ] of char;
  4070.     dwReserved1: DWORD;
  4071.     szPassword: Array [ 0..DPPASSWORDLEN-1 ] of char;
  4072.     dwReserved2: DWORD;
  4073.     dwUser1: DWORD;
  4074.     dwUser2: DWORD;
  4075.     dwUser3: DWORD;
  4076.     dwUser4: DWORD;
  4077.   end;
  4078.   PDPSESSIONDESC = ^TDPSESSIONDESC;
  4079.  
  4080.   TDPENUMSESSIONSCALLBACK = function (var lpDPSessionDesc: TDPSESSIONDESC;
  4081.       lpContext: Pointer; var lpdwTimeOut: DWORD;
  4082.       dwFlags: DWORD): BOOL; stdcall;
  4083.  
  4084. (*
  4085.  * IDirectPlay
  4086.  *)
  4087.   IDirectPlay = interface (IUnknown)
  4088.     ['{5454e9a0-db65-11ce-921c-00aa006c4972}']
  4089.     (*** IDirectPlay methods ***)
  4090.     function AddPlayerToGroup (pidGroup, pidPlayer: DPID): HRESULT; stdcall;
  4091.     function Close: HRESULT; stdcall;
  4092.     function CreatePlayer (var lppidID: DPID; lpPlayerFriendlyName: LPSTR;
  4093.         lpPlayerFormalName: LPSTR; lpEvent: PHandle): HRESULT; stdcall;
  4094.     function CreateGroup (var lppidID: DPID; lpGroupFriendlyName: LPSTR;
  4095.         lpGroupFormalName: LPSTR): HRESULT; stdcall;
  4096.     function DeletePlayerFromGroup (pidGroup, pidPlayer: DPID): HRESULT; stdcall;
  4097.     function DestroyPlayer (pidID: DPID): HRESULT; stdcall;
  4098.     function DestroyGroup (pidID: DPID): HRESULT; stdcall;
  4099.     function EnableNewPlayers (bEnable: BOOL): HRESULT; stdcall;
  4100.     function EnumGroupPlayers (pidGroupPID: DPID;
  4101.         lpEnumPlayersCallback: TDPENUMPLAYERSCALLBACK;
  4102.         lpContext: Pointer; dwFlags: DWORD): HRESULT; stdcall;
  4103.     function EnumGroups (dwSessionID: DWORD;
  4104.         lpEnumPlayersCallback: TDPENUMPLAYERSCALLBACK; lpContext: Pointer;
  4105.         dwFlags: DWORD): HRESULT; stdcall;
  4106.     function EnumPlayers (dwSessionId: DWORD;
  4107.         lpEnumPlayersCallback: TDPENUMPLAYERSCALLBACK; lpContext: Pointer;
  4108.         dwFlags: DWORD): HRESULT; stdcall;
  4109.     function EnumSessions (const lpSDesc: TDPSESSIONDESC; dwTimeout: DWORD;
  4110.         lpEnumSessionsCallback: TDPENUMSESSIONSCALLBACK; lpContext: Pointer;
  4111.         dwFlags: DWORD): HRESULT; stdcall;
  4112.     function GetCaps (const lpDPCaps: TDPCAPS): HRESULT; stdcall;
  4113.     function GetMessageCount (pidID: DPID; var lpdwCount: DWORD): HRESULT;
  4114.         stdcall;
  4115.     function GetPlayerCaps (pidID: DPID;
  4116.         const lpDPPlayerCaps: TDPCAPS): HRESULT; stdcall;
  4117.     function GetPlayerName (pidID: DPID; lpPlayerFriendlyName: LPSTR;
  4118.         var lpdwFriendlyNameLength: DWORD; lpPlayerFormalName: LPSTR;
  4119.         var lpdwFormalNameLength: DWORD): HRESULT; stdcall;
  4120.     function Initialize (const IID: TGUID): HRESULT; stdcall;
  4121.     function Open (const lpSDesc: TDPSESSIONDESC): HRESULT; stdcall;
  4122.     function Receive (var lppidFrom, lppidTo: DPID; dwFlags: DWORD;
  4123.         lpvBuffer: Pointer; var lpdwSize: DWORD): HRESULT; stdcall;
  4124.     (*** Warning!  SaveSession is defined differently in the header files
  4125.          and the online documentation ***)
  4126.     function SaveSession (lpSessionName: LPSTR): HRESULT; stdcall;
  4127.     function Send (pidFrom: DPID; pidTo: DPID; dwFlags: DWORD;
  4128.         lpvBuffer: Pointer; dwBuffSize: DWORD): HRESULT; stdcall;
  4129.     function SetPlayerName (pidID: DPID; lpPlayerFriendlyName: LPSTR;
  4130.         lpPlayerFormalName: LPSTR): HRESULT; stdcall;
  4131.   end;
  4132.  
  4133. function DirectPlayEnumerate (lpEnumDPCallback: TDPENUMDPCALLBACK;
  4134.     lpContext: Pointer): HRESULT; stdcall;
  4135. function DirectPlayCreate (const ServiceProvider: TGUID; out DP: IDirectPlay;
  4136.     pUnk: IUnknown): HRESULT; stdcall;
  4137.  
  4138.  
  4139. {------------- Direct 3D ----------------------}
  4140.  
  4141. { from d3dtypes.h }
  4142.  
  4143. type
  4144.   TD3DVALUE = single;
  4145.   TD3DFIXED = LongInt;
  4146.  
  4147. (*
  4148.  * Format of CI colors is
  4149.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4150.  *  |    alpha      |         color index           |   fraction    |
  4151.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4152.  *)
  4153.  
  4154. // #define CI_GETALPHA(ci)    ((ci) >> 24)
  4155. // #define CI_GETINDEX(ci)    (((ci) >> 8) & 0xffff)
  4156. // #define CI_GETFRACTION(ci) ((ci) & 0xff)
  4157. // #define CI_ROUNDINDEX(ci)  CI_GETINDEX((ci) + 0x80)
  4158. // #define CI_MASKALPHA(ci)   ((ci) & 0xffffff)
  4159. // #define CI_MAKE(a, i, f)    (((a) << 24) | ((i) << 8) | (f))
  4160.  
  4161. (*
  4162.  * Format of RGBA colors is
  4163.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4164.  *  |    alpha      |      red      |     green     |     blue      |
  4165.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4166.  *)
  4167.  
  4168. // #define RGBA_GETALPHA(rgb)      ((rgb) >> 24)
  4169. // #define RGBA_GETRED(rgb)        (((rgb) >> 16) & 0xff)
  4170. // #define RGBA_GETGREEN(rgb)      (((rgb) >> 8) & 0xff)
  4171. // #define RGBA_GETBLUE(rgb)       ((rgb) & 0xff)
  4172. // #define RGBA_MAKE(r, g, b, a)   ((D3DCOLOR) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)))
  4173.  
  4174. (* D3DRGB and D3DRGBA may be used as initialisers for D3DCOLORs
  4175.  * The float values must be in the range 0..1
  4176.  *)
  4177.  
  4178. // #define D3DRGB(r, g, b) \
  4179. //     (0xff000000L | ( ((long)((r) * 255)) << 16) | (((long)((g) * 255)) << 8) | (long)((b) * 255))
  4180. // #define D3DRGBA(r, g, b, a) \
  4181. //     (   (((long)((a) * 255)) << 24) | (((long)((r) * 255)) << 16) \
  4182. //     |   (((long)((g) * 255)) << 8) | (long)((b) * 255) \
  4183. //     )
  4184.  
  4185. (*
  4186.  * Format of RGB colors is
  4187.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4188.  *  |    ignored    |      red      |     green     |     blue      |
  4189.  *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4190.  *)
  4191.  
  4192. // #define RGB_GETRED(rgb)         (((rgb) >> 16) & 0xff)
  4193. // #define RGB_GETGREEN(rgb)       (((rgb) >> 8) & 0xff)
  4194. // #define RGB_GETBLUE(rgb)        ((rgb) & 0xff)
  4195. // #define RGBA_SETALPHA(rgba, x) (((x) << 24) | ((rgba) & 0x00ffffff))
  4196. // #define RGB_MAKE(r, g, b)       ((D3DCOLOR) (((r) << 16) | ((g) << 8) | (b)))
  4197. // #define RGBA_TORGB(rgba)       ((D3DCOLOR) ((rgba) & 0xffffff))
  4198. // #define RGB_TORGBA(rgb)        ((D3DCOLOR) ((rgb) | 0xff000000))
  4199.  
  4200. const
  4201.   D3DENUMRET_CANCEL                        = DDENUMRET_CANCEL;
  4202.   D3DENUMRET_OK                            = DDENUMRET_OK;
  4203.  
  4204. type
  4205.   TD3DVALIDATECALLBACK = function ( lpUserArg: Pointer;
  4206.       dwOffset: DWORD ): HRESULT; stdcall;
  4207.   TD3DENUMTEXTUREFORMATSCALLBACK = function ( const Ddsd: TDDSURFACEDESC;
  4208.       lpUserArg: Pointer ): HRESULT; stdcall;
  4209.  
  4210.   TD3DCOLOR = DWORD;
  4211.   TD3DMATERIALHANDLE = DWORD;
  4212.   TD3DTEXTUREHANDLE = DWORD;
  4213.   TD3DMATRIXHANDLE = DWORD;
  4214.  
  4215.   TD3DCOLORVALUE = record
  4216.     case Integer of
  4217.     0: (
  4218.       r: TD3DVALUE;
  4219.       g: TD3DVALUE;
  4220.       b: TD3DVALUE;
  4221.       a: TD3DVALUE;
  4222.       );
  4223.     1: (
  4224.       dvR: TD3DVALUE;
  4225.       dvG: TD3DVALUE;
  4226.       dvB: TD3DVALUE;
  4227.       dvA: TD3DVALUE;
  4228.       );
  4229.   end;
  4230.  
  4231.   TD3DRECT = record
  4232.     case Integer of
  4233.     0: (
  4234.       x1: LongInt;
  4235.       y1: LongInt;
  4236.       x2: LongInt;
  4237.       y2: LongInt;
  4238.       );
  4239.     1: (
  4240.       lX1: LongInt;
  4241.       lY1: LongInt;
  4242.       lX2: LongInt;
  4243.       lY2: LongInt;
  4244.       );
  4245.   end;
  4246.   PD3DRECT = ^TD3DRECT;
  4247.  
  4248.   TD3DVECTOR = record
  4249.     case Integer of
  4250.     0: (
  4251.       x: TD3DVALUE;
  4252.       y: TD3DVALUE;
  4253.       z: TD3DVALUE;
  4254.       );
  4255.     1: (
  4256.       dvX: TD3DVALUE;
  4257.       dvY: TD3DVALUE;
  4258.       dvZ: TD3DVALUE;
  4259.       );
  4260.   end;
  4261.   PD3DVECTOR = ^TD3DVECTOR;
  4262.  
  4263.  
  4264. (*
  4265.  * Vertex data types supported in an ExecuteBuffer.
  4266.  *)
  4267.  
  4268. (*
  4269.  * Homogeneous vertices
  4270.  *)
  4271.  
  4272.   TD3DHVERTEX = record
  4273.     dwFlags: DWORD;        (* Homogeneous clipping flags *)
  4274.     case Integer of
  4275.     0: (
  4276.       hx: TD3DVALUE;
  4277.       hy: TD3DVALUE;
  4278.       hz: TD3DVALUE;
  4279.       );
  4280.     1: (
  4281.       dvHX: TD3DVALUE;
  4282.       dvHY: TD3DVALUE;
  4283.       dvHZ: TD3DVALUE;
  4284.       );
  4285.   end;
  4286.   PD3DHVERTEX = ^TD3DHVERTEX;
  4287.  
  4288. (*
  4289.  * Transformed/lit vertices
  4290.  *)
  4291.  
  4292.   TD3DTLVERTEX = record
  4293.     case Integer of
  4294.     0: (
  4295.       sx: TD3DVALUE;             (* Screen coordinates *)
  4296.       sy: TD3DVALUE;
  4297.       sz: TD3DVALUE;
  4298.       rhw: TD3DVALUE;            (* Reciprocal of homogeneous w *)
  4299.       color: TD3DCOLOR;          (* Vertex color *)
  4300.       specular: TD3DCOLOR;       (* Specular component of vertex *)
  4301.       tu: TD3DVALUE;             (* Texture coordinates *)
  4302.       tv: TD3DVALUE;
  4303.       );
  4304.     1: (
  4305.       dvSX: TD3DVALUE;
  4306.       dvSY: TD3DVALUE;
  4307.       dvSZ: TD3DVALUE;
  4308.       dvRHW: TD3DVALUE;
  4309.       dcColor: TD3DCOLOR;
  4310.       dcSpecular: TD3DCOLOR;
  4311.       dvTU: TD3DVALUE;
  4312.       dvTV: TD3DVALUE;
  4313.       );
  4314.   end;
  4315.   PD3DTLVERTEX = ^TD3DTLVERTEX;
  4316.  
  4317. (*
  4318.  * Untransformed/lit vertices
  4319.  *)
  4320.  
  4321.   TD3DLVERTEX = record
  4322.     case Integer of
  4323.     0: (
  4324.       x: TD3DVALUE;             (* Homogeneous coordinates *)
  4325.       y: TD3DVALUE;
  4326.       z: TD3DVALUE;
  4327.       dwReserved: DWORD;
  4328.       color: TD3DCOLOR;         (* Vertex color *)
  4329.       specular: TD3DCOLOR;      (* Specular component of vertex *)
  4330.       tu: TD3DVALUE;            (* Texture coordinates *)
  4331.       tv: TD3DVALUE;
  4332.       );
  4333.     1: (
  4334.       dvX: TD3DVALUE;
  4335.       dvY: TD3DVALUE;
  4336.       dvZ: TD3DVALUE;
  4337.       UNIONFILLER1d: DWORD;
  4338.       dcColor: TD3DCOLOR;
  4339.       dcSpecular: TD3DCOLOR;
  4340.       dvTU: TD3DVALUE;
  4341.       dvTV: TD3DVALUE;
  4342.       );
  4343.   end;
  4344.  
  4345. (*
  4346.  * Untransformed/unlit vertices
  4347.  *)
  4348.  
  4349.   TD3DVERTEX = record
  4350.     case Integer of
  4351.     0: (
  4352.       x: TD3DVALUE;             (* Homogeneous coordinates *)
  4353.       y: TD3DVALUE;
  4354.       z: TD3DVALUE;
  4355.       nx: TD3DVALUE;            (* Normal *)
  4356.       ny: TD3DVALUE;
  4357.       nz: TD3DVALUE;
  4358.       tu: TD3DVALUE;            (* Texture coordinates *)
  4359.       tv: TD3DVALUE;
  4360.       );
  4361.     1: (
  4362.       dvX: TD3DVALUE;
  4363.       dvY: TD3DVALUE;
  4364.       dvZ: TD3DVALUE;
  4365.       dvNX: TD3DVALUE;
  4366.       dvNY: TD3DVALUE;
  4367.       dvNZ: TD3DVALUE;
  4368.       dvTU: TD3DVALUE;
  4369.       dvTV: TD3DVALUE;
  4370.       );
  4371.   end;
  4372.  
  4373. (*
  4374.  * Matrix, viewport, and tranformation structures and definitions.
  4375.  *)
  4376.  
  4377.   TD3DMATRIX = record
  4378.     _11, _12, _13, _14: TD3DVALUE;
  4379.     _21, _22, _23, _24: TD3DVALUE;
  4380.     _31, _32, _33, _34: TD3DVALUE;
  4381.     _41, _42, _43, _44: TD3DVALUE;
  4382.   end;
  4383.  
  4384.   TD3DVIEWPORT = record
  4385.     dwSize: DWORD;
  4386.     dwX: DWORD;
  4387.     dwY: DWORD;               (* Top left *)
  4388.     dwWidth: DWORD;
  4389.     dwHeight: DWORD;          (* Dimensions *)
  4390.     dvScaleX: TD3DVALUE;       (* Scale homogeneous to screen *)
  4391.     dvScaleY: TD3DVALUE;       (* Scale homogeneous to screen *)
  4392.     dvMaxX: TD3DVALUE;         (* Min/max homogeneous x coord *)
  4393.     dvMaxY: TD3DVALUE;         (* Min/max homogeneous y coord *)
  4394.     dvMinZ: TD3DVALUE;
  4395.     dvMaxZ: TD3DVALUE;         (* Min/max homogeneous z coord *)
  4396.   end;
  4397.  
  4398. (*
  4399.  * Values for clip fields.
  4400.  *)
  4401.  
  4402. const
  4403.   D3DCLIP_LEFT                            = $00000001;
  4404.   D3DCLIP_RIGHT                           = $00000002;
  4405.   D3DCLIP_TOP                             = $00000004;
  4406.   D3DCLIP_BOTTOM                          = $00000008;
  4407.   D3DCLIP_FRONT                           = $00000010;
  4408.   D3DCLIP_BACK                            = $00000020;
  4409.   D3DCLIP_GEN0                            = $00000040;
  4410.   D3DCLIP_GEN1                            = $00000080;
  4411.   D3DCLIP_GEN2                            = $00000100;
  4412.   D3DCLIP_GEN3                            = $00000200;
  4413.   D3DCLIP_GEN4                            = $00000400;
  4414.   D3DCLIP_GEN5                            = $00000800;
  4415.  
  4416. (*
  4417.  * Values for d3d status.
  4418.  *)
  4419.  
  4420.   D3DSTATUS_CLIPUNIONLEFT                 = D3DCLIP_LEFT;
  4421.   D3DSTATUS_CLIPUNIONRIGHT                = D3DCLIP_RIGHT;
  4422.   D3DSTATUS_CLIPUNIONTOP                  = D3DCLIP_TOP;
  4423.   D3DSTATUS_CLIPUNIONBOTTOM               = D3DCLIP_BOTTOM;
  4424.   D3DSTATUS_CLIPUNIONFRONT                = D3DCLIP_FRONT;
  4425.   D3DSTATUS_CLIPUNIONBACK                 = D3DCLIP_BACK;
  4426.   D3DSTATUS_CLIPUNIONGEN0                 = D3DCLIP_GEN0;
  4427.   D3DSTATUS_CLIPUNIONGEN1                 = D3DCLIP_GEN1;
  4428.   D3DSTATUS_CLIPUNIONGEN2                 = D3DCLIP_GEN2;
  4429.   D3DSTATUS_CLIPUNIONGEN3                 = D3DCLIP_GEN3;
  4430.   D3DSTATUS_CLIPUNIONGEN4                 = D3DCLIP_GEN4;
  4431.   D3DSTATUS_CLIPUNIONGEN5                 = D3DCLIP_GEN5;
  4432.  
  4433.   D3DSTATUS_CLIPINTERSECTIONLEFT          = $00001000;
  4434.   D3DSTATUS_CLIPINTERSECTIONRIGHT         = $00002000;
  4435.   D3DSTATUS_CLIPINTERSECTIONTOP           = $00004000;
  4436.   D3DSTATUS_CLIPINTERSECTIONBOTTOM        = $00008000;
  4437.   D3DSTATUS_CLIPINTERSECTIONFRONT         = $00010000;
  4438.   D3DSTATUS_CLIPINTERSECTIONBACK          = $00020000;
  4439.   D3DSTATUS_CLIPINTERSECTIONGEN0          = $00040000;
  4440.   D3DSTATUS_CLIPINTERSECTIONGEN1          = $00080000;
  4441.   D3DSTATUS_CLIPINTERSECTIONGEN2          = $00100000;
  4442.   D3DSTATUS_CLIPINTERSECTIONGEN3          = $00200000;
  4443.   D3DSTATUS_CLIPINTERSECTIONGEN4          = $00400000;
  4444.   D3DSTATUS_CLIPINTERSECTIONGEN5          = $00800000;
  4445.   D3DSTATUS_ZNOTVISIBLE                   = $01000000;
  4446.  
  4447.   D3DSTATUS_CLIPUNIONALL = (
  4448.             D3DSTATUS_CLIPUNIONLEFT or
  4449.             D3DSTATUS_CLIPUNIONRIGHT or
  4450.             D3DSTATUS_CLIPUNIONTOP or
  4451.             D3DSTATUS_CLIPUNIONBOTTOM or
  4452.             D3DSTATUS_CLIPUNIONFRONT or
  4453.             D3DSTATUS_CLIPUNIONBACK or
  4454.             D3DSTATUS_CLIPUNIONGEN0 or
  4455.             D3DSTATUS_CLIPUNIONGEN1 or
  4456.             D3DSTATUS_CLIPUNIONGEN2 or
  4457.             D3DSTATUS_CLIPUNIONGEN3 or
  4458.             D3DSTATUS_CLIPUNIONGEN4 or
  4459.             D3DSTATUS_CLIPUNIONGEN5 );
  4460.  
  4461.   D3DSTATUS_CLIPINTERSECTIONALL = (
  4462.             D3DSTATUS_CLIPINTERSECTIONLEFT or
  4463.             D3DSTATUS_CLIPINTERSECTIONRIGHT or
  4464.             D3DSTATUS_CLIPINTERSECTIONTOP or
  4465.             D3DSTATUS_CLIPINTERSECTIONBOTTOM or
  4466.             D3DSTATUS_CLIPINTERSECTIONFRONT or
  4467.             D3DSTATUS_CLIPINTERSECTIONBACK or
  4468.             D3DSTATUS_CLIPINTERSECTIONGEN0 or
  4469.             D3DSTATUS_CLIPINTERSECTIONGEN1 or
  4470.             D3DSTATUS_CLIPINTERSECTIONGEN2 or
  4471.             D3DSTATUS_CLIPINTERSECTIONGEN3 or
  4472.             D3DSTATUS_CLIPINTERSECTIONGEN4 or
  4473.             D3DSTATUS_CLIPINTERSECTIONGEN5 );
  4474.  
  4475.   D3DSTATUS_DEFAULT = (
  4476.             D3DSTATUS_CLIPINTERSECTIONALL or
  4477.             D3DSTATUS_ZNOTVISIBLE );
  4478.  
  4479. (*
  4480.  * Options for direct transform calls
  4481.  *)
  4482.  
  4483.   D3DTRANSFORM_CLIPPED       = $00000001;
  4484.   D3DTRANSFORM_UNCLIPPED     = $00000002;
  4485.  
  4486. type
  4487.   TD3DTRANSFORMDATA = record
  4488.     dwSize: DWORD;
  4489.     lpIn: Pointer;             (* Input vertices *)
  4490.     dwInSize: DWORD;           (* Stride of input vertices *)
  4491.     lpOut: Pointer;            (* Output vertices *)
  4492.     dwOutSize: DWORD;          (* Stride of output vertices *)
  4493.     lpHOut: PD3DHVERTEX;       (* Output homogeneous vertices *)
  4494.     dwClip: DWORD;             (* Clipping hint *)
  4495.     dwClipIntersection: DWORD;
  4496.     dwClipUnion: DWORD;        (* Union of all clip flags *)
  4497.     drExtent: TD3DRECT;         (* Extent of transformed vertices *)
  4498.   end;
  4499.  
  4500. (*
  4501.  * Structure defining position and direction properties for lighting.
  4502.  *)
  4503.  
  4504.   TD3DLIGHTINGELEMENT = record
  4505.     dvPosition: TD3DVECTOR;           (* Lightable point in model space *)
  4506.     dvNormal: TD3DVECTOR;             (* Normalised unit vector *)
  4507.   end;
  4508.   PD3DLIGHTINGELEMENT = ^TD3DLIGHTINGELEMENT;
  4509.  
  4510. (*
  4511.  * Structure defining material properties for lighting.
  4512.  *)
  4513.  
  4514.   TD3DMATERIAL = record
  4515.     dwSize: DWORD;
  4516.     case Integer of
  4517.     0: (
  4518.       diffuse: TD3DCOLORVALUE;        (* Diffuse color RGBA *)
  4519.       ambient: TD3DCOLORVALUE;        (* Ambient color RGB *)
  4520.       specular: TD3DCOLORVALUE;       (* Specular 'shininess' *)
  4521.       emissive: TD3DCOLORVALUE;       (* Emissive color RGB *)
  4522.       power: TD3DVALUE;               (* Sharpness if specular highlight *)
  4523.       hTexture: TD3DTEXTUREHANDLE;    (* Handle to texture map *)
  4524.       dwRampSize: DWORD;
  4525.       );
  4526.     1: (
  4527.       dcvDiffuse: TD3DCOLORVALUE;
  4528.       dcvAmbient: TD3DCOLORVALUE;
  4529.       dcvSpecular: TD3DCOLORVALUE;
  4530.       dcvEmissive: TD3DCOLORVALUE;
  4531.       dvPower: TD3DVALUE;
  4532.       );
  4533.   end;
  4534.   PD3DMATERIAL = ^TD3DMATERIAL;
  4535.  
  4536.   TD3DLIGHTTYPE = (
  4537.     D3DLIGHT_INVALID_0,
  4538.     D3DLIGHT_POINT,
  4539.     D3DLIGHT_SPOT,
  4540.     D3DLIGHT_DIRECTIONAL,
  4541.     D3DLIGHT_PARALLELPOINT,
  4542.     D3DLIGHT_GLSPOT );
  4543.  
  4544. (*
  4545.  * Structure defining a light source and its properties.
  4546.  *)
  4547.  
  4548.   TD3DLIGHT = record
  4549.     dwSize: DWORD;
  4550.     dltType: TD3DLIGHTTYPE;     (* Type of light source *)
  4551.     dcvColor: TD3DCOLORVALUE;   (* Color of light *)
  4552.     dvPosition: TD3DVECTOR;     (* Position in world space *)
  4553.     dvDirection: TD3DVECTOR;    (* Direction in world space *)
  4554.     dvRange: TD3DVALUE;         (* Cutoff range *)
  4555.     dvFalloff: TD3DVALUE;       (* Falloff *)
  4556.     dvAttenuation0: TD3DVALUE;  (* Constant attenuation *)
  4557.     dvAttenuation1: TD3DVALUE;  (* Linear attenuation *)
  4558.     dvAttenuation2: TD3DVALUE;  (* Quadratic attenuation *)
  4559.     dvTheta: TD3DVALUE;         (* Inner angle of spotlight cone *)
  4560.     dvPhi: TD3DVALUE;           (* Outer angle of spotlight cone *)
  4561.   end;
  4562.  
  4563.   TD3DLIGHTDATA = record
  4564.     dwSize: DWORD;
  4565.     lpIn: PD3DLIGHTINGELEMENT;   (* Input positions and normals *)
  4566.     dwInSize: DWORD;             (* Stride of input elements *)
  4567.     lpOut: PD3DTLVERTEX;         (* Output colors *)
  4568.     dwOutSize: DWORD;            (* Stride of output colors *)
  4569.   end;
  4570.  
  4571.   TD3DCOLORMODEL = (
  4572.     D3DCOLOR_INVALID_0,
  4573.     D3DCOLOR_MONO,
  4574.     D3DCOLOR_RGB );
  4575.  
  4576. (*
  4577.  * Options for clearing
  4578.  *)
  4579.  
  4580. const
  4581.   D3DCLEAR_TARGET            = $00000001; (* Clear target surface *)
  4582.   D3DCLEAR_ZBUFFER           = $00000002; (* Clear target z buffer *)
  4583.  
  4584. (*
  4585.  * Execute buffers are allocated via Direct3D.  These buffers may then
  4586.  * be filled by the application with instructions to execute along with
  4587.  * vertex data.
  4588.  *)
  4589.  
  4590. (*
  4591.  * Supported op codes for execute instructions.
  4592.  *)
  4593.  
  4594. type
  4595.   TD3DOPCODE = (
  4596.     D3DOP_INVALID_0,
  4597.     D3DOP_POINT,
  4598.     D3DOP_LINE,
  4599.     D3DOP_TRIANGLE,
  4600.     D3DOP_MATRIXLOAD,
  4601.     D3DOP_MATRIXMULTIPLY,
  4602.     D3DOP_STATETRANSFORM,
  4603.     D3DOP_STATELIGHT,
  4604.     D3DOP_STATERENDER,
  4605.     D3DOP_PROCESSVERTICES,
  4606.     D3DOP_TEXTURELOAD,
  4607.     D3DOP_EXIT,
  4608.     D3DOP_BRANCHFORWARD,
  4609.     D3DOP_SPAN,
  4610.     D3DOP_SETSTATUS );
  4611.  
  4612.   TD3DINSTRUCTION = record
  4613.     bOpcode: BYTE;   (* Instruction opcode *)
  4614.     bSize: BYTE;     (* Size of each instruction data unit *)
  4615.     wCount: WORD;    (* Count of instruction data units to follow *)
  4616.   end;
  4617.  
  4618. (*
  4619.  * Structure for texture loads
  4620.  *)
  4621.  
  4622.   TD3DTEXTURELOAD = record
  4623.     hDestTexture: TD3DTEXTUREHANDLE;
  4624.     hSrcTexture: TD3DTEXTUREHANDLE;
  4625.   end;
  4626.  
  4627. (*
  4628.  * Structure for picking
  4629.  *)
  4630.  
  4631.   TD3DPICKRECORD = record
  4632.     bOpcode: BYTE;
  4633.     bPad: BYTE;
  4634.     dwOffset: DWORD;
  4635.     dvZ: TD3DVALUE;
  4636.   end;
  4637.   PD3DPICKRECORD = ^TD3DPICKRECORD;
  4638.  
  4639. (*
  4640.  * The following defines the rendering states which can be set in the
  4641.  * execute buffer.
  4642.  *)
  4643.  
  4644.   TD3DSHADEMODE = (
  4645.     D3DSHADE_INVALID_0,
  4646.     D3DSHADE_FLAT,
  4647.     D3DSHADE_GOURAUD,
  4648.     D3DSHADE_PHONG );
  4649.  
  4650.   TD3DFILLMODE = (
  4651.     D3DFILL_INVALID_0,
  4652.     D3DFILL_POINT,
  4653.     D3DFILL_WIREFRAME,
  4654.     D3DFILL_SOLID );
  4655.  
  4656.   TD3DLINEPATTERN = record
  4657.     wRepeatFactor: WORD;
  4658.     wLinePattern: WORD;
  4659.   end;
  4660.  
  4661.   TD3DTEXTUREFILTER = (
  4662.     D3DFILTER_INVALID_0,
  4663.     D3DFILTER_NEAREST,
  4664.     D3DFILTER_LINEAR,
  4665.     D3DFILTER_MIPNEAREST,
  4666.     D3DFILTER_MIPLINEAR,
  4667.     D3DFILTER_LINEARMIPNEAREST,
  4668.     D3DFILTER_LINEARMIPLINEAR );
  4669.  
  4670.   TD3DBLEND = (
  4671.     D3DBLEND_INVALID_0,
  4672.     D3DBLEND_ZERO,
  4673.     D3DBLEND_ONE,
  4674.     D3DBLEND_SRCCOLOR,
  4675.     D3DBLEND_INVSRCCOLOR,
  4676.     D3DBLEND_SRCALPHA,
  4677.     D3DBLEND_INVSRCALPHA,
  4678.     D3DBLEND_DESTALPHA,
  4679.     D3DBLEND_INVDESTALPHA,
  4680.     D3DBLEND_DESTCOLOR,
  4681.     D3DBLEND_INVDESTCOLOR,
  4682.     D3DBLEND_SRCALPHASAT,
  4683.     D3DBLEND_BOTHSRCALPHA,
  4684.     D3DBLEND_BOTHINVSRCALPHA );
  4685.  
  4686.   TD3DTEXTUREBLEND = (
  4687.     D3DTBLEND_INVALID_0,
  4688.     D3DTBLEND_DECAL,
  4689.     D3DTBLEND_MODULATE,
  4690.     D3DTBLEND_DECALALPHA,
  4691.     D3DTBLEND_MODULATEALPHA,
  4692.     D3DTBLEND_DECALMASK,
  4693.     D3DTBLEND_MODULATEMASK,
  4694.     D3DTBLEND_COPY );
  4695.  
  4696.   TD3DTEXTUREADDRESS = (
  4697.     D3DTADDRESS_INVALID_0,
  4698.     D3DTADDRESS_WRAP,
  4699.     D3DTADDRESS_MIRROR,
  4700.     D3DTADDRESS_CLAMP );
  4701.  
  4702.   TD3DCULL = (
  4703.     D3DCULL_INVALID_0,
  4704.     D3DCULL_NONE,
  4705.     D3DCULL_CW,
  4706.     D3DCULL_CCW );
  4707.  
  4708.   TD3DCMPFUNC = (
  4709.     D3DCMP_INVALID_0,
  4710.     D3DCMP_NEVER,
  4711.     D3DCMP_LESS,
  4712.     D3DCMP_EQUAL,
  4713.     D3DCMP_LESSEQUAL,
  4714.     D3DCMP_GREATER,
  4715.     D3DCMP_NOTEQUAL,
  4716.     D3DCMP_GREATEREQUAL,
  4717.     D3DCMP_ALWAYS );
  4718.  
  4719.   TD3DFOGMODE = (
  4720.     D3DFOG_NONE,
  4721.     D3DFOG_EXP,
  4722.     D3DFOG_EXP2,
  4723.     D3DFOG_LINEAR );
  4724.  
  4725. (*
  4726.  * Amount to add to a state to generate the override for that state.
  4727.  *)
  4728.  
  4729. const
  4730.   D3DSTATE_OVERRIDE_BIAS          = 256;
  4731.  
  4732. type
  4733.   TD3DTRANSFORMSTATETYPE = (
  4734.     D3DTRANSFORMSTATE_INVALID_0,
  4735.     D3DTRANSFORMSTATE_WORLD,
  4736.     D3DTRANSFORMSTATE_VIEW,
  4737.     D3DTRANSFORMSTATE_PROJECTION );
  4738.  
  4739.   TD3DLIGHTSTATETYPE = (
  4740.     D3DLIGHTSTATE_INVALID_0,
  4741.     D3DLIGHTSTATE_MATERIAL,
  4742.     D3DLIGHTSTATE_AMBIENT,
  4743.     D3DLIGHTSTATE_COLORMODEL,
  4744.     D3DLIGHTSTATE_FOGMODE,
  4745.     D3DLIGHTSTATE_FOGSTART,
  4746.     D3DLIGHTSTATE_FOGEND,
  4747.     D3DLIGHTSTATE_FOGDENSITY );
  4748.  
  4749.   TD3DRENDERSTATETYPE = (
  4750.     D3DRENDERSTATE_INVALID_0,
  4751.     D3DRENDERSTATE_TEXTUREHANDLE,       (* Texture handle *)
  4752.     D3DRENDERSTATE_ANTIALIAS,           (* Antialiasing prim edges *)
  4753.     D3DRENDERSTATE_TEXTUREADDRESS,      (* D3DTEXTUREADDRESS      *)
  4754.     D3DRENDERSTATE_TEXTUREPERSPECTIVE,  (* TRUE for perspective correction *)
  4755.     D3DRENDERSTATE_WRAPU,               (* TRUE for wrapping in u *)
  4756.     D3DRENDERSTATE_WRAPV,               (* TRUE for wrapping in v *)
  4757.     D3DRENDERSTATE_ZENABLE,             (* TRUE to enable z test *)
  4758.     D3DRENDERSTATE_FILLMODE,            (* D3DFILL_MODE            *)
  4759.     D3DRENDERSTATE_SHADEMODE,           (* D3DSHADEMODE *)
  4760.     D3DRENDERSTATE_LINEPATTERN,         (* D3DLINEPATTERN *)
  4761.     D3DRENDERSTATE_MONOENABLE,          (* TRUE to enable mono rasterization *)
  4762.     D3DRENDERSTATE_ROP2,                (* ROP2 *)
  4763.     D3DRENDERSTATE_PLANEMASK,           (* DWORD physical plane mask *)
  4764.     D3DRENDERSTATE_ZWRITEENABLE,        (* TRUE to enable z writes *)
  4765.     D3DRENDERSTATE_ALPHATESTENABLE,     (* TRUE to enable alpha tests *)
  4766.     D3DRENDERSTATE_LASTPIXEL,           (* TRUE for last-pixel on lines *)
  4767.     D3DRENDERSTATE_TEXTUREMAG,          (* D3DTEXTUREFILTER *)
  4768.     D3DRENDERSTATE_TEXTUREMIN,          (* D3DTEXTUREFILTER *)
  4769.     D3DRENDERSTATE_SRCBLEND,            (* D3DBLEND *)
  4770.     D3DRENDERSTATE_DESTBLEND,           (* D3DBLEND *)
  4771.     D3DRENDERSTATE_TEXTUREMAPBLEND,     (* D3DTEXTUREBLEND *)
  4772.     D3DRENDERSTATE_CULLMODE,            (* D3DCULL *)
  4773.     D3DRENDERSTATE_ZFUNC,               (* D3DCMPFUNC *)
  4774.     D3DRENDERSTATE_ALPHAREF,            (* D3DFIXED *)
  4775.     D3DRENDERSTATE_ALPHAFUNC,           (* D3DCMPFUNC *)
  4776.     D3DRENDERSTATE_DITHERENABLE,        (* TRUE to enable dithering *)
  4777.     D3DRENDERSTATE_BLENDENABLE,         (* TRUE to enable alpha blending *)
  4778.     D3DRENDERSTATE_FOGENABLE,           (* TRUE to enable fog *)
  4779.     D3DRENDERSTATE_SPECULARENABLE,      (* TRUE to enable specular *)
  4780.     D3DRENDERSTATE_ZVISIBLE,            (* TRUE to enable z checking *)
  4781.     D3DRENDERSTATE_SUBPIXEL,            (* TRUE to enable subpixel correction *)
  4782.     D3DRENDERSTATE_SUBPIXELX,           (* TRUE to enable correction in X only *)
  4783.     D3DRENDERSTATE_STIPPLEDALPHA,       (* TRUE to enable stippled alpha *)
  4784.     D3DRENDERSTATE_FOGCOLOR,            (* D3DCOLOR *)
  4785.     D3DRENDERSTATE_FOGTABLEMODE,        (* D3DFOGMODE *)
  4786.     D3DRENDERSTATE_FOGTABLESTART,       (* Fog table start        *)
  4787.     D3DRENDERSTATE_FOGTABLEEND,         (* Fog table end          *)
  4788.     D3DRENDERSTATE_FOGTABLEDENSITY,     (* Fog table density      *)
  4789.     D3DRENDERSTATE_STIPPLEENABLE,       (* TRUE to enable stippling *)
  4790.     D3DRENDERSTATE_INVALID_40,
  4791.     D3DRENDERSTATE_INVALID_41,
  4792.     D3DRENDERSTATE_INVALID_42,
  4793.     D3DRENDERSTATE_INVALID_43,
  4794.     D3DRENDERSTATE_INVALID_44,
  4795.     D3DRENDERSTATE_INVALID_45,
  4796.     D3DRENDERSTATE_INVALID_46,
  4797.     D3DRENDERSTATE_INVALID_47,
  4798.     D3DRENDERSTATE_INVALID_48,
  4799.     D3DRENDERSTATE_INVALID_49,
  4800.     D3DRENDERSTATE_INVALID_50,
  4801.     D3DRENDERSTATE_INVALID_51,
  4802.     D3DRENDERSTATE_INVALID_52,
  4803.     D3DRENDERSTATE_INVALID_53,
  4804.     D3DRENDERSTATE_INVALID_54,
  4805.     D3DRENDERSTATE_INVALID_55,
  4806.     D3DRENDERSTATE_INVALID_56,
  4807.     D3DRENDERSTATE_INVALID_57,
  4808.     D3DRENDERSTATE_INVALID_58,
  4809.     D3DRENDERSTATE_INVALID_59,
  4810.     D3DRENDERSTATE_INVALID_60,
  4811.     D3DRENDERSTATE_INVALID_61,
  4812.     D3DRENDERSTATE_INVALID_62,
  4813.     D3DRENDERSTATE_INVALID_63,
  4814.     D3DRENDERSTATE_STIPPLEPATTERN00,   (* Stipple pattern 01...  *)
  4815.     D3DRENDERSTATE_STIPPLEPATTERN01,
  4816.     D3DRENDERSTATE_STIPPLEPATTERN02,
  4817.     D3DRENDERSTATE_STIPPLEPATTERN03,
  4818.     D3DRENDERSTATE_STIPPLEPATTERN04,
  4819.     D3DRENDERSTATE_STIPPLEPATTERN05,
  4820.     D3DRENDERSTATE_STIPPLEPATTERN06,
  4821.     D3DRENDERSTATE_STIPPLEPATTERN07,
  4822.     D3DRENDERSTATE_STIPPLEPATTERN08,
  4823.     D3DRENDERSTATE_STIPPLEPATTERN09,
  4824.     D3DRENDERSTATE_STIPPLEPATTERN10,
  4825.     D3DRENDERSTATE_STIPPLEPATTERN11,
  4826.     D3DRENDERSTATE_STIPPLEPATTERN12,
  4827.     D3DRENDERSTATE_STIPPLEPATTERN13,
  4828.     D3DRENDERSTATE_STIPPLEPATTERN14,
  4829.     D3DRENDERSTATE_STIPPLEPATTERN15,
  4830.     D3DRENDERSTATE_STIPPLEPATTERN16,
  4831.     D3DRENDERSTATE_STIPPLEPATTERN17,
  4832.     D3DRENDERSTATE_STIPPLEPATTERN18,
  4833.     D3DRENDERSTATE_STIPPLEPATTERN19,
  4834.     D3DRENDERSTATE_STIPPLEPATTERN20,
  4835.     D3DRENDERSTATE_STIPPLEPATTERN21,
  4836.     D3DRENDERSTATE_STIPPLEPATTERN22,
  4837.     D3DRENDERSTATE_STIPPLEPATTERN23,
  4838.     D3DRENDERSTATE_STIPPLEPATTERN24,
  4839.     D3DRENDERSTATE_STIPPLEPATTERN25,
  4840.     D3DRENDERSTATE_STIPPLEPATTERN26,
  4841.     D3DRENDERSTATE_STIPPLEPATTERN27,
  4842.     D3DRENDERSTATE_STIPPLEPATTERN28,
  4843.     D3DRENDERSTATE_STIPPLEPATTERN29,
  4844.     D3DRENDERSTATE_STIPPLEPATTERN30,
  4845.     D3DRENDERSTATE_STIPPLEPATTERN31 );
  4846.  
  4847.   TD3DSTATE = record
  4848.     case Integer of
  4849.     0: (
  4850.       dtstTransformStateType: TD3DTRANSFORMSTATETYPE;
  4851.       dwArg: Array [ 0..0 ] of DWORD;
  4852.       );
  4853.     1: (
  4854.       dlstLightStateType: TD3DLIGHTSTATETYPE;
  4855.       dvArg: Array [ 0..0 ] of TD3DVALUE;
  4856.       );
  4857.     2: (
  4858.       drstRenderStateType: TD3DRENDERSTATETYPE;
  4859.       );
  4860.   end;
  4861.  
  4862. (*
  4863.  * Operation used to load matrices
  4864.  * hDstMat = hSrcMat
  4865.  *)
  4866.  
  4867.   TD3DMATRIXLOAD = record
  4868.     hDestMatrix: TD3DMATRIXHANDLE;   (* Destination matrix *)
  4869.     hSrcMatrix: TD3DMATRIXHANDLE;    (* Source matrix *)
  4870.   end;
  4871.  
  4872. (*
  4873.  * Operation used to multiply matrices
  4874.  * hDstMat = hSrcMat1 * hSrcMat2
  4875.  *)
  4876.  
  4877.   TD3DMATRIXMULTIPLY = record
  4878.     hDestMatrix: TD3DMATRIXHANDLE;   (* Destination matrix *)
  4879.     hSrcMatrix1: TD3DMATRIXHANDLE;   (* First source matrix *)
  4880.     hSrcMatrix2: TD3DMATRIXHANDLE;   (* Second source matrix *)
  4881.   end;
  4882.  
  4883. (*
  4884.  * Operation used to transform and light vertices.
  4885.  *)
  4886.  
  4887.   TD3DPROCESSVERTICES = record
  4888.     dwFlags: DWORD;           (* Do we transform or light or just copy? *)
  4889.     wStart: WORD;             (* Index to first vertex in source *)
  4890.     wDest: WORD;              (* Index to first vertex in local buffer *)
  4891.     dwCount: DWORD;           (* Number of vertices to be processed *)
  4892.     dwReserved: DWORD;        (* Must be zero *)
  4893.   end;
  4894.  
  4895. const
  4896.   D3DPROCESSVERTICES_TRANSFORMLIGHT       = $00000000;
  4897.   D3DPROCESSVERTICES_TRANSFORM            = $00000001;
  4898.   D3DPROCESSVERTICES_COPY                 = $00000002;
  4899.   D3DPROCESSVERTICES_OPMASK               = $00000007;
  4900.  
  4901.   D3DPROCESSVERTICES_UPDATEEXTENTS        = $00000008;
  4902.   D3DPROCESSVERTICES_NOCOLOR              = $00000010;
  4903.  
  4904. (*
  4905.  * Triangle flags
  4906.  *)
  4907.  
  4908. (*
  4909.  * Tri strip and fan flags.
  4910.  * START loads all three vertices
  4911.  * EVEN and ODD load just v3 with even or odd culling
  4912.  * START_FLAT contains a count from 0 to 29 that allows the
  4913.  * whole strip or fan to be culled in one hit.
  4914.  * e.g. for a quad len = 1
  4915.  *)
  4916.  
  4917.   D3DTRIFLAG_START                        = $00000000;
  4918. // #define D3DTRIFLAG_STARTFLAT(len) (len)         (* 0 < len < 30 *)
  4919.   D3DTRIFLAG_ODD                          = $0000001e;
  4920.   D3DTRIFLAG_EVEN                         = $0000001f;
  4921.  
  4922. (*
  4923.  * Triangle edge flags
  4924.  * enable edges for wireframe or antialiasing
  4925.  *)
  4926.  
  4927.   D3DTRIFLAG_EDGEENABLE1                  = $00000100; (* v0-v1 edge *)
  4928.   D3DTRIFLAG_EDGEENABLE2                  = $00000200; (* v1-v2 edge *)
  4929.   D3DTRIFLAG_EDGEENABLE3                  = $00000400; (* v2-v0 edge *)
  4930.   D3DTRIFLAG_EDGEENABLETRIANGLE = (
  4931.       D3DTRIFLAG_EDGEENABLE1 or D3DTRIFLAG_EDGEENABLE2 or D3DTRIFLAG_EDGEENABLE3 );
  4932.  
  4933. (*
  4934.  * Primitive structures and related defines.  Vertex offsets are to types
  4935.  * D3DVERTEX, D3DLVERTEX, or D3DTLVERTEX.
  4936.  *)
  4937.  
  4938. (*
  4939.  * Triangle list primitive structure
  4940.  *)
  4941.  
  4942. type
  4943.   TD3DTRIANGLE = record
  4944.     case Integer of
  4945.     0: (
  4946.       v1: WORD;            (* Vertex indices *)
  4947.       v2: WORD;
  4948.       v3: WORD;
  4949.       wFlags: WORD;        (* Edge (and other) flags *)
  4950.       );
  4951.     1: (
  4952.       wV1: WORD;
  4953.       wV2: WORD;
  4954.       wV3: WORD;
  4955.       );
  4956.   end;
  4957.  
  4958. (*
  4959.  * Line strip structure.
  4960.  * The instruction count - 1 defines the number of line segments.
  4961.  *)
  4962.  
  4963.   TD3DLINE = record
  4964.     case Integer of
  4965.     0: (
  4966.       v1: WORD;            (* Vertex indices *)
  4967.       v2: WORD;
  4968.       );
  4969.     1: (
  4970.       wV1: WORD;
  4971.       wV2: WORD;
  4972.       );
  4973.   end;
  4974.  
  4975. (*
  4976.  * Span structure
  4977.  * Spans join a list of points with the same y value.
  4978.  * If the y value changes, a new span is started.
  4979.  *)
  4980.  
  4981.   TD3DSPAN = record
  4982.     wCount: WORD;        (* Number of spans *)
  4983.     wFirst: WORD;        (* Index to first vertex *)
  4984.   end;
  4985.  
  4986. (*
  4987.  * Point structure
  4988.  *)
  4989.  
  4990.   TD3DPOINT = record
  4991.     wCount: WORD;        (* number of points         *)
  4992.     wFirst: WORD;        (* index to first vertex    *)
  4993.   end;
  4994.  
  4995. (*
  4996.  * Forward branch structure.
  4997.  * Mask is logically anded with the driver status mask
  4998.  * if the result equals 'value', the branch is taken.
  4999.  *)
  5000.  
  5001.   TD3DBRANCH = record
  5002.     dwMask: DWORD;         (* Bitmask against D3D status *)
  5003.     dwValue: DWORD;
  5004.     bNegate: BOOL;         (* TRUE to negate comparison *)
  5005.     dwOffset: DWORD;       (* How far to branch forward (0 for exit)*)
  5006.   end;
  5007.  
  5008. (*
  5009.  * Status used for set status instruction.
  5010.  * The D3D status is initialised on device creation
  5011.  * and is modified by all execute calls.
  5012.  *)
  5013.  
  5014.   TD3DSTATUS = record
  5015.     dwFlags: DWORD;        (* Do we set extents or status *)
  5016.     dwStatus: DWORD;       (* D3D status *)
  5017.     drExtent: TD3DRECT;
  5018.   end;
  5019.  
  5020. const
  5021.   D3DSETSTATUS_STATUS   = $00000001;
  5022.   D3DSETSTATUS_EXTENTS  = $00000002;
  5023.   D3DSETSTATUS_ALL      = ( D3DSETSTATUS_STATUS or D3DSETSTATUS_EXTENTS );
  5024.  
  5025. (*
  5026.  * Statistics structure
  5027.  *)
  5028.  
  5029. type
  5030.   TD3DSTATS = record
  5031.     dwSize: DWORD;
  5032.     dwTrianglesDrawn: DWORD;
  5033.     dwLinesDrawn: DWORD;
  5034.     dwPointsDrawn: DWORD;
  5035.     dwSpansDrawn: DWORD;
  5036.     dwVerticesProcessed: DWORD;
  5037.   end;
  5038.  
  5039. (*
  5040.  * Execute options.
  5041.  * When calling using D3DEXECUTE_UNCLIPPED all the primitives
  5042.  * inside the buffer must be contained within the viewport.
  5043.  *)
  5044.  
  5045. const
  5046.   D3DEXECUTE_CLIPPED       = $00000001;
  5047.   D3DEXECUTE_UNCLIPPED     = $00000002;
  5048.  
  5049. type
  5050.   TD3DEXECUTEDATA = record
  5051.     dwSize: DWORD;
  5052.     dwVertexOffset: DWORD;
  5053.     dwVertexCount: DWORD;
  5054.     dwInstructionOffset: DWORD;
  5055.     dwInstructionLength: DWORD;
  5056.     dwHVertexOffset: DWORD;
  5057.     dsStatus: TD3DSTATUS;       (* Status after execute *)
  5058.   end;
  5059.  
  5060. (*
  5061.  * Palette flags.
  5062.  * This are or'ed with the peFlags in the PALETTEENTRYs passed to DirectDraw.
  5063.  *)
  5064.  
  5065. const
  5066.   D3DPAL_FREE     = $00;    (* Renderer may use this entry freely *)
  5067.   D3DPAL_READONLY = $40;    (* Renderer may not set this entry *)
  5068.   D3DPAL_RESERVED = $80;    (* Renderer may not use this entry *)
  5069.  
  5070.  
  5071. { from d3dcaps.h }
  5072.  
  5073. (* Description of capabilities of transform *)
  5074.  
  5075. type
  5076.   TD3DTRANSFORMCAPS = record
  5077.     dwSize: DWORD;
  5078.     dwCaps: DWORD;
  5079.   end;
  5080.  
  5081. const
  5082.   D3DTRANSFORMCAPS_CLIP           = $00000001; (* Will clip whilst transforming *)
  5083.  
  5084. (* Description of capabilities of lighting *)
  5085.  
  5086. type
  5087.   TD3DLIGHTINGCAPS = record
  5088.     dwSize: DWORD;
  5089.     dwCaps: DWORD;                   (* Lighting caps *)
  5090.     dwLightingModel: DWORD;          (* Lighting model - RGB or mono *)
  5091.     dwNumLights: DWORD;              (* Number of lights that can be handled *)
  5092.   end;
  5093.  
  5094. const
  5095.   D3DLIGHTINGMODEL_RGB            = $00000001;
  5096.   D3DLIGHTINGMODEL_MONO           = $00000002;
  5097.  
  5098.   D3DLIGHTCAPS_POINT              = $00000001; (* Point lights supported *)
  5099.   D3DLIGHTCAPS_SPOT               = $00000002; (* Spot lights supported *)
  5100.   D3DLIGHTCAPS_DIRECTIONAL        = $00000004; (* Directional lights supported *)
  5101.   D3DLIGHTCAPS_PARALLELPOINT      = $00000008; (* Parallel point lights supported *)
  5102.   D3DLIGHTCAPS_GLSPOT             = $00000010; (* GL syle spot lights supported *)
  5103.  
  5104. (* D3DPRIMCAPS dwMiscCaps *)
  5105.  
  5106.   D3DPMISCCAPS_MASKPLANES         = $00000001;
  5107.   D3DPMISCCAPS_MASKZ              = $00000002;
  5108.   D3DPMISCCAPS_LINEPATTERNREP     = $00000004;
  5109.   D3DPMISCCAPS_CONFORMANT         = $00000008;
  5110.   D3DPMISCCAPS_CULLNONE           = $00000010;
  5111.   D3DPMISCCAPS_CULLCW             = $00000020;
  5112.   D3DPMISCCAPS_CULLCCW            = $00000040;
  5113.  
  5114. (* D3DPRIMCAPS dwRasterCaps *)
  5115.  
  5116.   D3DPRASTERCAPS_DITHER           = $00000001;
  5117.   D3DPRASTERCAPS_ROP2             = $00000002;
  5118.   D3DPRASTERCAPS_XOR              = $00000004;
  5119.   D3DPRASTERCAPS_PAT              = $00000008;
  5120.   D3DPRASTERCAPS_ZTEST            = $00000010;
  5121.   D3DPRASTERCAPS_SUBPIXEL         = $00000020;
  5122.   D3DPRASTERCAPS_SUBPIXELX        = $00000040;
  5123.   D3DPRASTERCAPS_FOGVERTEX        = $00000080;
  5124.   D3DPRASTERCAPS_FOGTABLE         = $00000100;
  5125.   D3DPRASTERCAPS_STIPPLE          = $00000200;
  5126.  
  5127. (* Description of capabilities for each primitive type *)
  5128.  
  5129. type
  5130.   TD3DPrimCaps = record
  5131.     dwSize: DWORD;
  5132.     dwMiscCaps: DWORD;                 (* Capability flags *)
  5133.     dwRasterCaps: DWORD;
  5134.     dwZCmpCaps: DWORD;
  5135.     dwSrcBlendCaps: DWORD;
  5136.     dwDestBlendCaps: DWORD;
  5137.     dwAlphaCmpCaps: DWORD;
  5138.     dwShadeCaps: DWORD;
  5139.     dwTextureCaps: DWORD;
  5140.     dwTextureFilterCaps: DWORD;
  5141.     dwTextureBlendCaps: DWORD;
  5142.     dwTextureAddressCaps: DWORD;
  5143.     dwStippleWidth: DWORD;             (* maximum width and height of *)
  5144.     dwStippleHeight: DWORD;            (* of supported stipple (up to 32x32) *)
  5145.   end;
  5146.  
  5147. (* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps *)
  5148.  
  5149. const
  5150.   D3DPCMPCAPS_NEVER               = $00000001;
  5151.   D3DPCMPCAPS_LESS                = $00000002;
  5152.   D3DPCMPCAPS_EQUAL               = $00000004;
  5153.   D3DPCMPCAPS_LESSEQUAL           = $00000008;
  5154.   D3DPCMPCAPS_GREATER             = $00000010;
  5155.   D3DPCMPCAPS_NOTEQUAL            = $00000020;
  5156.   D3DPCMPCAPS_GREATEREQUAL        = $00000040;
  5157.   D3DPCMPCAPS_ALWAYS              = $00000080;
  5158.  
  5159. (* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps *)
  5160.  
  5161.   D3DPBLENDCAPS_ZERO              = $00000001;
  5162.   D3DPBLENDCAPS_ONE               = $00000002;
  5163.   D3DPBLENDCAPS_SRCCOLOR          = $00000004;
  5164.   D3DPBLENDCAPS_INVSRCCOLOR       = $00000008;
  5165.   D3DPBLENDCAPS_SRCALPHA          = $00000010;
  5166.   D3DPBLENDCAPS_INVSRCALPHA       = $00000020;
  5167.   D3DPBLENDCAPS_DESTALPHA         = $00000040;
  5168.   D3DPBLENDCAPS_INVDESTALPHA      = $00000080;
  5169.   D3DPBLENDCAPS_DESTCOLOR         = $00000100;
  5170.   D3DPBLENDCAPS_INVDESTCOLOR      = $00000200;
  5171.   D3DPBLENDCAPS_SRCALPHASAT       = $00000400;
  5172.   D3DPBLENDCAPS_BOTHSRCALPHA      = $00000800;
  5173.   D3DPBLENDCAPS_BOTHINVSRCALPHA   = $00001000;
  5174.  
  5175. (* D3DPRIMCAPS dwShadeCaps *)
  5176.  
  5177.   D3DPSHADECAPS_COLORFLATMONO             = $00000001;
  5178.   D3DPSHADECAPS_COLORFLATRGB              = $00000002;
  5179.   D3DPSHADECAPS_COLORGOURAUDMONO          = $00000004;
  5180.   D3DPSHADECAPS_COLORGOURAUDRGB           = $00000008;
  5181.   D3DPSHADECAPS_COLORPHONGMONO            = $00000010;
  5182.   D3DPSHADECAPS_COLORPHONGRGB             = $00000020;
  5183.  
  5184.   D3DPSHADECAPS_SPECULARFLATMONO          = $00000040;
  5185.   D3DPSHADECAPS_SPECULARFLATRGB           = $00000080;
  5186.   D3DPSHADECAPS_SPECULARGOURAUDMONO       = $00000100;
  5187.   D3DPSHADECAPS_SPECULARGOURAUDRGB        = $00000200;
  5188.   D3DPSHADECAPS_SPECULARPHONGMONO         = $00000400;
  5189.   D3DPSHADECAPS_SPECULARPHONGRGB          = $00000800;
  5190.  
  5191.   D3DPSHADECAPS_ALPHAFLATBLEND            = $00001000;
  5192.   D3DPSHADECAPS_ALPHAFLATSTIPPLED         = $00002000;
  5193.   D3DPSHADECAPS_ALPHAGOURAUDBLEND         = $00004000;
  5194.   D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED      = $00008000;
  5195.   D3DPSHADECAPS_ALPHAPHONGBLEND           = $00010000;
  5196.   D3DPSHADECAPS_ALPHAPHONGSTIPPLED        = $00020000;
  5197.  
  5198.   D3DPSHADECAPS_FOGFLAT                   = $00040000;
  5199.   D3DPSHADECAPS_FOGGOURAUD                = $00080000;
  5200.   D3DPSHADECAPS_FOGPHONG                  = $00100000;
  5201.  
  5202. (* D3DPRIMCAPS dwTextureCaps *)
  5203.  
  5204.   D3DPTEXTURECAPS_PERSPECTIVE     = $00000001;
  5205.   D3DPTEXTURECAPS_POW2            = $00000002;
  5206.   D3DPTEXTURECAPS_ALPHA           = $00000004;
  5207.   D3DPTEXTURECAPS_TRANSPARENCY    = $00000008;
  5208.   D3DPTEXTURECAPS_BORDER          = $00000010;
  5209.   D3DPTEXTURECAPS_SQUAREONLY      = $00000020;
  5210.  
  5211. (* D3DPRIMCAPS dwTextureFilterCaps *)
  5212.  
  5213.   D3DPTFILTERCAPS_NEAREST         = $00000001;
  5214.   D3DPTFILTERCAPS_LINEAR          = $00000002;
  5215.   D3DPTFILTERCAPS_MIPNEAREST      = $00000004;
  5216.   D3DPTFILTERCAPS_MIPLINEAR       = $00000008;
  5217.   D3DPTFILTERCAPS_LINEARMIPNEAREST = $00000010;
  5218.   D3DPTFILTERCAPS_LINEARMIPLINEAR = $00000020;
  5219.  
  5220. (* D3DPRIMCAPS dwTextureBlendCaps *)
  5221.  
  5222.   D3DPTBLENDCAPS_DECAL            = $00000001;
  5223.   D3DPTBLENDCAPS_MODULATE         = $00000002;
  5224.   D3DPTBLENDCAPS_DECALALPHA       = $00000004;
  5225.   D3DPTBLENDCAPS_MODULATEALPHA    = $00000008;
  5226.   D3DPTBLENDCAPS_DECALMASK        = $00000010;
  5227.   D3DPTBLENDCAPS_MODULATEMASK     = $00000020;
  5228.   D3DPTBLENDCAPS_COPY             = $00000040;
  5229.  
  5230. (* D3DPRIMCAPS dwTextureAddressCaps *)
  5231.   D3DPTADDRESSCAPS_WRAP           = $00000001;
  5232.   D3DPTADDRESSCAPS_MIRROR         = $00000002;
  5233.   D3DPTADDRESSCAPS_CLAMP          = $00000004;
  5234.  
  5235. (*
  5236.  * Description for a device.
  5237.  * This is used to describe a device that is to be created or to query
  5238.  * the current device.
  5239.  *)
  5240.  
  5241. type
  5242.   TD3DDeviceDesc = record
  5243.     dwSize: DWORD;                       (* Size of D3DDEVICEDESC structure *)
  5244.     dwFlags: DWORD;                      (* Indicates which fields have valid data *)
  5245.     dcmColorModel: TD3DCOLORMODEL;        (* Color model of device *)
  5246.     dwDevCaps: DWORD;                    (* Capabilities of device *)
  5247.     dtcTransformCaps: TD3DTRANSFORMCAPS;  (* Capabilities of transform *)
  5248.     bClipping: BOOL;                     (* Device can do 3D clipping *)
  5249.     dlcLightingCaps: TD3DLIGHTINGCAPS;    (* Capabilities of lighting *)
  5250.     dpcLineCaps: TD3DPRIMCAPS;
  5251.     dpcTriCaps: TD3DPRIMCAPS;
  5252.     dwDeviceRenderBitDepth: DWORD;       (* One of DDBB_8, 16, etc.. *)
  5253.     dwDeviceZBufferBitDepth: DWORD;      (* One of DDBD_16, 32, etc.. *)
  5254.     dwMaxBufferSize: DWORD;              (* Maximum execute buffer size *)
  5255.     dwMaxVertexCount: DWORD;             (* Maximum vertex count *)
  5256.   end;
  5257.  
  5258.   TD3DENUMDEVICESCALLBACK = function ( const Guid: TGUID;
  5259.       lpDeviceDescription, lpDeviceName: PChar;
  5260.       const lpD3DHWDeviceDesc: TD3DDEVICEDESC;
  5261.       const lpD3DHELDeviceDesc: TD3DDEVICEDESC;
  5262.       lpUserArg: Pointer): HRESULT; stdcall;
  5263.  
  5264. (* D3DDEVICEDESC dwFlags indicating valid fields *)
  5265.  
  5266. const
  5267.   D3DDD_COLORMODEL            = $00000001; (* dcmColorModel is valid *)
  5268.   D3DDD_DEVCAPS               = $00000002; (* dwDevCaps is valid *)
  5269.   D3DDD_TRANSFORMCAPS         = $00000004; (* dtcTransformCaps is valid *)
  5270.   D3DDD_LIGHTINGCAPS          = $00000008; (* dlcLightingCaps is valid *)
  5271.   D3DDD_BCLIPPING             = $00000010; (* bClipping is valid *)
  5272.   D3DDD_LINECAPS              = $00000020; (* dpcLineCaps is valid *)
  5273.   D3DDD_TRICAPS               = $00000040; (* dpcTriCaps is valid *)
  5274.   D3DDD_DEVICERENDERBITDEPTH  = $00000080; (* dwDeviceRenderBitDepth is valid *)
  5275.   D3DDD_DEVICEZBUFFERBITDEPTH = $00000100; (* dwDeviceZBufferBitDepth is valid *)
  5276.   D3DDD_MAXBUFFERSIZE         = $00000200; (* dwMaxBufferSize is valid *)
  5277.   D3DDD_MAXVERTEXCOUNT        = $00000400; (* dwMaxVertexCount is valid *)
  5278.  
  5279. (* D3DDEVICEDESC dwDevCaps flags *)
  5280.  
  5281.   D3DDEVCAPS_FLOATTLVERTEX        = $00000001; (* Device accepts floating point *)
  5282.                                                     (* for post-transform vertex data *)
  5283.   D3DDEVCAPS_SORTINCREASINGZ      = $00000002; (* Device needs data sorted for increasing Z*)
  5284.   D3DDEVCAPS_SORTDECREASINGZ      = $00000004; (* Device needs data sorted for decreasing Z*)
  5285.   D3DDEVCAPS_SORTEXACT            = $00000008; (* Device needs data sorted exactly *)
  5286.  
  5287.   D3DDEVCAPS_EXECUTESYSTEMMEMORY  = $00000010; (* Device can use execute buffers from system memory *)
  5288.   D3DDEVCAPS_EXECUTEVIDEOMEMORY   = $00000020; (* Device can use execute buffers from video memory *)
  5289.   D3DDEVCAPS_TLVERTEXSYSTEMMEMORY = $00000040; (* Device can use TL buffers from system memory *)
  5290.   D3DDEVCAPS_TLVERTEXVIDEOMEMORY  = $00000080; (* Device can use TL buffers from video memory *)
  5291.   D3DDEVCAPS_TEXTURESYSTEMMEMORY  = $00000100; (* Device can texture from system memory *)
  5292.   D3DDEVCAPS_TEXTUREVIDEOMEMORY   = $00000200; (* Device can texture from device memory *)
  5293.  
  5294.   D3DFDS_COLORMODEL        = $00000001; (* Match color model *)
  5295.   D3DFDS_GUID              = $00000002; (* Match guid *)
  5296.   D3DFDS_HARDWARE          = $00000004; (* Match hardware/software *)
  5297.   D3DFDS_TRIANGLES         = $00000008; (* Match in triCaps *)
  5298.   D3DFDS_LINES             = $00000010; (* Match in lineCaps  *)
  5299.   D3DFDS_MISCCAPS          = $00000020; (* Match primCaps.dwMiscCaps *)
  5300.   D3DFDS_RASTERCAPS        = $00000040; (* Match primCaps.dwRasterCaps *)
  5301.   D3DFDS_ZCMPCAPS          = $00000080; (* Match primCaps.dwZCmpCaps *)
  5302.   D3DFDS_ALPHACMPCAPS      = $00000100; (* Match primCaps.dwAlphaCmpCaps *)
  5303.   D3DFDS_SRCBLENDCAPS      = $00000200; (* Match primCaps.dwSourceBlendCaps *)
  5304.   D3DFDS_DSTBLENDCAPS      = $00000400; (* Match primCaps.dwDestBlendCaps *)
  5305.   D3DFDS_SHADECAPS         = $00000800; (* Match primCaps.dwShadeCaps *)
  5306.   D3DFDS_TEXTURECAPS       = $00001000; (* Match primCaps.dwTextureCaps *)
  5307.   D3DFDS_TEXTUREFILTERCAPS = $00002000; (* Match primCaps.dwTextureFilterCaps *)
  5308.   D3DFDS_TEXTUREBLENDCAPS  = $00004000; (* Match primCaps.dwTextureBlendCaps *)
  5309.   D3DFDS_TEXTUREADDRESSCAPS  = $00008000; (* Match primCaps.dwTextureBlendCaps *)
  5310.  
  5311. (*
  5312.  * FindDevice arguments
  5313.  *)
  5314.  
  5315. type
  5316.   TD3DFINDDEVICESEARCH = record
  5317.     dwSize: DWORD;
  5318.     dwFlags: DWORD;
  5319.     bHardware: BOOL;
  5320.     dcmColorModel: TD3DCOLORMODEL;
  5321.     guid: TGUID;
  5322.     dwCaps: DWORD;
  5323.     dpcPrimCaps: TD3DPRIMCAPS;
  5324.   end;
  5325.  
  5326.   TD3DFINDDEVICERESULT = record
  5327.     dwSize: DWORD;
  5328.     guid: TGUID;               (* guid which matched *)
  5329.     ddHwDesc: TD3DDEVICEDESC;   (* hardware D3DDEVICEDESC *)
  5330.     ddSwDesc: TD3DDEVICEDESC;   (* software D3DDEVICEDESC *)
  5331.   end;
  5332.  
  5333. (*
  5334.  * Description of execute buffer.
  5335.  *)
  5336.  
  5337.   TD3DExecuteBufferDesc = record
  5338.     dwSize: DWORD;         (* size of this structure *)
  5339.     dwFlags: DWORD;        (* flags indicating which fields are valid *)
  5340.     dwCaps: DWORD;         (* capabilities of execute buffer *)
  5341.     dwBufferSize: DWORD;   (* size of execute buffer data *)
  5342.     lpData: Pointer;       (* pointer to actual data *)
  5343.   end;
  5344.  
  5345. (* D3DEXECUTEBUFFER dwFlags indicating valid fields *)
  5346.  
  5347. const
  5348.   D3DDEB_BUFSIZE          = $00000001;     (* buffer size valid *)
  5349.   D3DDEB_CAPS             = $00000002;     (* caps valid *)
  5350.   D3DDEB_LPDATA           = $00000004;     (* lpData valid *)
  5351.  
  5352. (* D3DEXECUTEBUFFER dwCaps *)
  5353.  
  5354.   D3DDEBCAPS_SYSTEMMEMORY = $00000001;     (* buffer in system memory *)
  5355.   D3DDEBCAPS_VIDEOMEMORY  = $00000002;     (* buffer in device memory *)
  5356.   D3DDEBCAPS_MEM          = ( D3DDEBCAPS_SYSTEMMEMORY or D3DDEBCAPS_VIDEOMEMORY );
  5357.  
  5358. (*
  5359.  * Flags for execute buffer calls
  5360.  *)
  5361. const
  5362.   D3DNEXT_NEXT    = $00000001;
  5363.   D3DNEXT_HEAD    = $00000002;
  5364.   D3DNEXT_TAIL    = $00000004;
  5365.  
  5366. { from d3d.h }
  5367.  
  5368. type
  5369.   IDirect3D = interface;
  5370.   IDirect3DDevice = interface;
  5371.   IDirect3DExecuteBuffer = interface;
  5372.   IDirect3DLight = interface;
  5373.   IDirect3DMaterial = interface;
  5374.   IDirect3DTexture = interface;
  5375.   IDirect3DViewport = interface;
  5376.  
  5377. (*
  5378.  * IDirect3D
  5379.  *)
  5380.  
  5381.   IDirect3D = interface(IUnknown)
  5382.     ['{3BBA0080-2421-11CF-A31A-00AA00B93356}']
  5383.     function Initialize(const IID: TGUID): HRESULT; stdcall;
  5384.     function EnumDevices(lpEnumDevicesCallback: TD3DENUMDEVICESCALLBACK;
  5385.         lpUserArg: Pointer): HRESULT;  stdcall;
  5386.     function CreateLight(out lplpDirect3Dlight: IDirect3DLight;
  5387.         const pUnkOuter: IUnknown): HRESULT;  stdcall;
  5388.     function CreateMaterial(out lplpDirect3DMaterial: IDirect3DMaterial;
  5389.         const pUnkOuter: IUnknown): HRESULT;  stdcall;
  5390.     function CreateViewport(out lplpD3DViewport: IDirect3DViewport;
  5391.         const pUnkOuter: IUnknown): HRESULT;  stdcall;
  5392.     function FindDevice(const lpD3DFDS:TD3DFINDDEVICESEARCH;
  5393.         var lpD3DFDR:TD3DFINDDEVICERESULT): HRESULT;  stdcall;
  5394.   end;
  5395.  
  5396. (*
  5397.  * IDirect3DDevice
  5398.  *)
  5399.  
  5400.   IDirect3DDevice = interface(IUnknown)
  5401.     function Initialize(const lpd3d: IDirect3D; const lpGUID: TGUID;
  5402.       const lpd3ddvdesc:TD3DDEVICEDESC): HRESULT;  stdcall;
  5403.     function GetCaps(var lpD3DHWDevDesc:TD3DDEVICEDESC;
  5404.       var lpD3DHELDevDesc:TD3DDEVICEDESC): HRESULT;  stdcall;
  5405.     function SwapTextureHandles(const Tex1, Tex2: IDirect3DTexture): HRESULT;
  5406.       stdcall;
  5407.     function CreateExecuteBuffer(const lpDesc:TD3DEXECUTEBUFFERDESC;
  5408.       out lplpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  5409.       const pUnkOuter: IUnknown): HRESULT;  stdcall;
  5410.     function GetStats(var lpD3DStats:TD3DSTATS): HRESULT; stdcall;
  5411.     function Execute(const lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  5412.       const lpDirect3DViewport: IDirect3DViewport;
  5413.       dwFlags: DWORD): HRESULT; stdcall;
  5414.     function AddViewport(const lpDirect3DViewport: IDirect3DViewport): HRESULT;
  5415.       stdcall;
  5416.     function DeleteViewport(
  5417.       const lpDirect3DViewport: IDirect3DViewport): HRESULT; stdcall;
  5418.     function NextViewport(const lpDirect3DViewport: IDirect3DViewport;
  5419.       out lplpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD): HRESULT;
  5420.       stdcall;
  5421.     function Pick(const lpDirect3DExecuteBuffer: IDirect3DExecuteBuffer;
  5422.       const lpDirect3DViewport: IDirect3DViewport; dwFlags: DWORD;
  5423.       const lpRect:TD3DRECT): HRESULT;  stdcall;
  5424.     function GetPickRecords(var lpCount: DWORD;
  5425.       lpD3DPickRec: PD3DPICKRECORD): HRESULT;  stdcall;
  5426.     function EnumTextureFormats(
  5427.       lpd3dEnumTextureProc: TD3DENUMTEXTUREFORMATSCALLBACK;
  5428.       lpArg: Pointer): HRESULT;  stdcall;
  5429.     function CreateMatrix(var lpD3DMatHandle:TD3DMATRIXHANDLE): HRESULT;
  5430.       stdcall;
  5431.     function SetMatrix(d3dMatHandle:TD3DMATRIXHANDLE;
  5432.       const lpD3DMatrix:TD3DMATRIX): HRESULT;  stdcall;
  5433.     function GetMatrix(const lpD3DMatHandle:TD3DMATRIXHANDLE;
  5434.       var lpD3DMatrix:TD3DMATRIX): HRESULT;  stdcall;
  5435.     function DeleteMatrix(d3dMatHandle:TD3DMATRIXHANDLE): HRESULT; stdcall;
  5436.     function BeginScene: HRESULT;  stdcall;
  5437.     function EndScene: HRESULT;  stdcall;
  5438.     function GetDirect3D(out lpD3D: IDirect3D): HRESULT;  stdcall;
  5439.   end;
  5440.  
  5441. (*
  5442.  * IDirect3DExecuteBuffer
  5443.  *)
  5444.  
  5445.   IDirect3DExecuteBuffer = interface(IUnknown)
  5446.     ['{4417C145-33AD-11CF-816F-0000C020156E}']
  5447.     function Initialize(const lpDirect3DDevice: IDirect3DDevice;
  5448.         const lpDesc:TD3DEXECUTEBUFFERDESC): HRESULT;  stdcall;
  5449.     function Lock(const lpDesc:TD3DEXECUTEBUFFERDESC): HRESULT; stdcall;
  5450.     function Unlock: HRESULT;  stdcall;
  5451.     function SetExecuteData(const lpData:TD3DEXECUTEDATA): HRESULT; stdcall;
  5452.     function GetExecuteData(var lpData:TD3DEXECUTEDATA): HRESULT; stdcall;
  5453.     function Validate(var lpdwOffset: DWORD; lpFunc: TD3DVALIDATECALLBACK;
  5454.         lpUserArg: Pointer; dwReserved: DWORD): HRESULT;  stdcall;
  5455.     function Optimize(dwFlags: DWORD): HRESULT;  stdcall;
  5456.   end;
  5457.  
  5458. (*
  5459.  * IDirect3DLight
  5460.  *)
  5461.  
  5462.   IDirect3DLight = interface(IUnknown)
  5463.     ['{4417C142-33AD-11CF-816F-0000C020156E}']
  5464.     function Initialize(const lpDirect3D: IDirect3D): HRESULT;  stdcall;
  5465.     function SetLight(const lpLight:TD3DLIGHT): HRESULT; stdcall;
  5466.     function GetLight(var lpLight:TD3DLIGHT): HRESULT; stdcall;
  5467.   end;
  5468.  
  5469. (*
  5470.  * IDirect3DMaterial
  5471.  *)
  5472.  
  5473.   IDirect3DMaterial = interface(IUnknown)
  5474.     ['{4417C144-33AD-11CF-816F-0000C020156E}']
  5475.     function Initialize(const lpDirect3D: IDirect3D): HRESULT;  stdcall;
  5476.     function SetMaterial(const lpMat:TD3DMATERIAL): HRESULT; stdcall;
  5477.     function GetMaterial(var lpMat:TD3DMATERIAL): HRESULT;  stdcall;
  5478.     function GetHandle(const lpDirect3DDevice: IDirect3DDevice;
  5479.         var lpHandle:TD3DMATERIALHANDLE): HRESULT;  stdcall;
  5480.     function Reserve: HRESULT;  stdcall;
  5481.     function Unreserve: HRESULT;  stdcall;
  5482.   end;
  5483.  
  5484. (*
  5485.  * IDirect3DTexture
  5486.  *)
  5487.  
  5488.   IDirect3DTexture = interface(IUnknown)
  5489.     ['{2CDCD9E0-25A0-11CF-A31A-00AA00B93356}']
  5490.     function Initialize(const lpD3DDevice: IDirect3DDevice;
  5491.         const lpDDSurface: IDirectDrawSurface): HRESULT;  stdcall;
  5492.     function GetHandle(const lpDirect3DDevice: IDirect3DDevice;
  5493.         var lpHandle:TD3DTEXTUREHANDLE): HRESULT;  stdcall;
  5494.     function PaletteChanged(dwStart: DWORD; dwCount: DWORD): HRESULT; stdcall;
  5495.     function Load(const lpD3DTexture: IDirect3DTexture): HRESULT; stdcall;
  5496.     function Unload: HRESULT;  stdcall;
  5497.   end;
  5498.  
  5499. (*
  5500.  * IDirect3DViewport
  5501.  *)
  5502.  
  5503.   IDirect3DViewport = interface(IUnknown)
  5504.     ['{4417C146-33AD-11CF-816F-0000C020156E}']
  5505.     function Initialize(const lpDirect3D: IDirect3D): HRESULT; stdcall;
  5506.     function GetViewport(var lpData:TD3DVIEWPORT): HRESULT; stdcall;
  5507.     function SetViewport(const lpData:TD3DVIEWPORT): HRESULT; stdcall;
  5508.     function TransformVertices(dwVertexCount: DWORD;
  5509.         var lpData:TD3DTRANSFORMDATA; dwFlags: DWORD;
  5510.         var lpOffscreen: DWORD): HRESULT;  stdcall;
  5511.     function LightElements(dwElementCount: DWORD;
  5512.         var lpData:TD3DLIGHTDATA): HRESULT;  stdcall;
  5513.     function SetBackground(hMat:TD3DMATERIALHANDLE): HRESULT; stdcall;
  5514.     function GetBackground(hMat:TD3DMATERIALHANDLE): HRESULT; stdcall;
  5515.     function SetBackgroundDepth(const lpDDSurface: IDirectDrawSurface): HRESULT;
  5516.         stdcall;
  5517.     function GetBackgroundDepth(out lplpDDSurface: IDirectDrawSurface;
  5518.         var lpValid: BOOL): HRESULT;  stdcall;
  5519.     function Clear(dwCount: DWORD; lpRects: PD3DRECT;
  5520.         dwFlags: DWORD): HRESULT;  stdcall;
  5521.     function AddLight(const lpDirect3DLight: IDirect3DLight): HRESULT; stdcall;
  5522.     function DeleteLight(const lpDirect3DLight: IDirect3DLight): HRESULT; stdcall;
  5523.     function NextLight(const lpDirect3DLight: IDirect3DLight;
  5524.         out lplpDirect3DLight: IDirect3DLight; dwFlags: DWORD): HRESULT;
  5525.         stdcall;
  5526.   end;
  5527.  
  5528. (*
  5529.  * Direct3D Errors
  5530.  * DirectDraw error codes are used when errors not specified here.
  5531.  *)
  5532.  
  5533. const
  5534.   D3D_OK                          = DD_OK;
  5535.   D3DERR_BADMAJORVERSION          = $88760000 + 700;
  5536.   D3DERR_BADMINORVERSION          = $88760000 + 701;
  5537.  
  5538.   D3DERR_EXECUTE_CREATE_FAILED    = $88760000 + 710;
  5539.   D3DERR_EXECUTE_DESTROY_FAILED   = $88760000 + 711;
  5540.   D3DERR_EXECUTE_LOCK_FAILED      = $88760000 + 712;
  5541.   D3DERR_EXECUTE_UNLOCK_FAILED    = $88760000 + 713;
  5542.   D3DERR_EXECUTE_LOCKED           = $88760000 + 714;
  5543.   D3DERR_EXECUTE_NOT_LOCKED       = $88760000 + 715;
  5544.  
  5545.   D3DERR_EXECUTE_FAILED           = $88760000 + 716;
  5546.   D3DERR_EXECUTE_CLIPPED_FAILED   = $88760000 + 717;
  5547.  
  5548.   D3DERR_TEXTURE_NO_SUPPORT       = $88760000 + 720;
  5549.   D3DERR_TEXTURE_CREATE_FAILED    = $88760000 + 721;
  5550.   D3DERR_TEXTURE_DESTROY_FAILED   = $88760000 + 722;
  5551.   D3DERR_TEXTURE_LOCK_FAILED      = $88760000 + 723;
  5552.   D3DERR_TEXTURE_UNLOCK_FAILED    = $88760000 + 724;
  5553.   D3DERR_TEXTURE_LOAD_FAILED      = $88760000 + 725;
  5554.   D3DERR_TEXTURE_SWAP_FAILED      = $88760000 + 726;
  5555.   D3DERR_TEXTURE_LOCKED           = $88760000 + 727;
  5556.   D3DERR_TEXTURE_NOT_LOCKED       = $88760000 + 728;
  5557.   D3DERR_TEXTURE_GETSURF_FAILED   = $88760000 + 729;
  5558.  
  5559.   D3DERR_MATRIX_CREATE_FAILED     = $88760000 + 730;
  5560.   D3DERR_MATRIX_DESTROY_FAILED    = $88760000 + 731;
  5561.   D3DERR_MATRIX_SETDATA_FAILED    = $88760000 + 732;
  5562.   D3DERR_MATRIX_GETDATA_FAILED    = $88760000 + 733;
  5563.   D3DERR_SETVIEWPORTDATA_FAILED   = $88760000 + 734;
  5564.  
  5565.   D3DERR_MATERIAL_CREATE_FAILED   = $88760000 + 740;
  5566.   D3DERR_MATERIAL_DESTROY_FAILED  = $88760000 + 741;
  5567.   D3DERR_MATERIAL_SETDATA_FAILED  = $88760000 + 742;
  5568.   D3DERR_MATERIAL_GETDATA_FAILED  = $88760000 + 743;
  5569.  
  5570.   D3DERR_LIGHT_SET_FAILED         = $88760000 + 750;
  5571.  
  5572.   D3DERR_SCENE_IN_SCENE           = $88760000 + 760;
  5573.   D3DERR_SCENE_NOT_IN_SCENE       = $88760000 + 761;
  5574.   D3DERR_SCENE_BEGIN_FAILED       = $88760000 + 762;
  5575.   D3DERR_SCENE_END_FAILED         = $88760000 + 763;
  5576.  
  5577. { from d3drmdef.h }
  5578.  
  5579. type
  5580.   TD3DRMVECTOR4D = record
  5581.     x, y, z, w:TD3DVALUE;
  5582.   end;
  5583.   PD3DRMVECTOR4D = ^TD3DRMVECTOR4D;
  5584.  
  5585.   TD3DRMMATRIX4D = Array [0..4, 0..4] of TD3DVALUE;
  5586.  
  5587.   TD3DRMQUATERNION = record
  5588.     s:TD3DVALUE;
  5589.     v:TD3DVECTOR;
  5590.   end;
  5591.   PD3DRMQUATERNION = ^TD3DRMQUATERNION;
  5592.  
  5593.   TD3DRMBOX = record
  5594.     min, max: TD3DVECTOR;
  5595.   end;
  5596.   PD3DRMBOX = ^TD3DRMBOX;
  5597.  
  5598.   TD3DRMWRAPCALLBACK = procedure ( var lpD3DVector:TD3DVECTOR;
  5599.       var lpU, lpV: Integer; var lpD3DRMVA, lpD3DRMVB:TD3DVECTOR;
  5600.       lpArg: Pointer ); stdcall;
  5601.  
  5602.   TD3DRMLIGHTTYPE = ( D3DRMLIGHT_AMBIENT, D3DRMLIGHT_POINT, D3DRMLIGHT_SPOT,
  5603.       D3DRMLIGHT_DIRECTIONAL, D3DRMLIGHT_PARALLELPOINT );
  5604.   PD3DRMLIGHTTYPE = ^TD3DRMLIGHTTYPE;
  5605.  
  5606.   TD3DRMSHADEMODE = WORD;
  5607.   PD3DRMSHADEMODE = ^TD3DRMSHADEMODE;
  5608.  
  5609. const
  5610.   D3DRMSHADE_FLAT = 0;
  5611.   D3DRMSHADE_GOURAUD = 1;
  5612.   D3DRMSHADE_PHONG = 2;
  5613.   D3DRMSHADE_MASK = 7;
  5614.   D3DRMSHADE_MAX = 8;
  5615.  
  5616. type
  5617.   TD3DRMLIGHTMODE = WORD;
  5618.   PD3DRMLIGHTMOD = ^TD3DRMLIGHTMODE;
  5619.  
  5620. const
  5621.   D3DRMLIGHT_OFF  = 0 * D3DRMSHADE_MAX;
  5622.   D3DRMLIGHT_ON   = 1 * D3DRMSHADE_MAX;
  5623.   D3DRMLIGHT_MASK = 7 * D3DRMSHADE_MAX;
  5624.   D3DRMLIGHT_MAX  = 8 * D3DRMSHADE_MAX;
  5625.  
  5626. type
  5627.   TD3DRMFILLMODE = WORD;
  5628.   PD3DRMFILLMODE = ^TD3DRMFILLMODE;
  5629.  
  5630. const
  5631.   D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX;
  5632.   D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX;
  5633.   D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX;
  5634.   D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX;
  5635.   D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX;
  5636.  
  5637. type
  5638.   TD3DRMRENDERQUALITY = DWORD;
  5639.   PD3DRMRENDERQUALITY = ^TD3DRMRENDERQUALITY;
  5640.  
  5641. const
  5642.   D3DRMRENDER_WIREFRAME   = ( D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_WIREFRAME );
  5643.   D3DRMRENDER_UNLITFLAT   = ( D3DRMSHADE_FLAT + D3DRMLIGHT_OFF + D3DRMFILL_SOLID );
  5644.   D3DRMRENDER_FLAT        = ( D3DRMSHADE_FLAT + D3DRMLIGHT_ON + D3DRMFILL_SOLID );
  5645.   D3DRMRENDER_GOURAUD     = ( D3DRMSHADE_GOURAUD + D3DRMLIGHT_ON + D3DRMFILL_SOLID );
  5646.   D3DRMRENDER_PHONG       = ( D3DRMSHADE_PHONG + D3DRMLIGHT_ON + D3DRMFILL_SOLID );
  5647.  
  5648. type
  5649.   TD3DRMTEXTUREQUALITY = (
  5650.     D3DRMTEXTURE_NEAREST,               (* choose nearest texel *)
  5651.     D3DRMTEXTURE_LINEAR,                (* interpolate 4 texels *)
  5652.     D3DRMTEXTURE_MIPNEAREST,            (* nearest texel in nearest mipmap  *)
  5653.     D3DRMTEXTURE_MIPLINEAR,             (* interpolate 2 texels from 2 mipmaps *)
  5654.     D3DRMTEXTURE_LINEARMIPNEAREST,      (* interpolate 4 texels in nearest mipmap *)
  5655.     D3DRMTEXTURE_LINEARMIPLINEAR        (* interpolate 8 texels from 2 mipmaps *)
  5656.   );
  5657.   PD3DRMTEXTUREQUALITY = ^TD3DRMTEXTUREQUALITY;
  5658.  
  5659.   TD3DRMCOMBINETYPE = ( D3DRMCOMBINE_REPLACE, D3DRMCOMBINE_BEFORE, D3DRMCOMBINE_AFTER );
  5660.   PD3DRMCOMBINETYPE = ^TD3DRMCOMBINETYPE;
  5661.  
  5662.   TD3DRMCOLORMODEL = TD3DCOLORMODEL;
  5663.   PD3DRMCOLORMODEL = ^TD3DRMCOLORMODEL;
  5664.  
  5665.   TD3DRMPALETTEFLAGS = (
  5666.     D3DRMPALETTE_FREE,                  (* renderer may use this entry freely *)
  5667.     D3DRMPALETTE_READONLY,              (* fixed but may be used by renderer *)
  5668.     D3DRMPALETTE_RESERVED               (* may not be used by renderer *)
  5669.   );
  5670.   PD3DRMPALETTEFLAGS = ^TD3DRMPALETTEFLAGS;
  5671.  
  5672.   TD3DRMPALETTEENTRY = record
  5673.     red: Byte;          (* 0 .. 255 *)
  5674.     green: Byte;        (* 0 .. 255 *)
  5675.     blue: Byte;         (* 0 .. 255 *)
  5676.     flags: Byte;        (* one of D3DRMPALETTEFLAGS *)
  5677.   end;
  5678.   PD3DRMPALETTEENTRY = ^TD3DRMPALETTEENTRY;
  5679.  
  5680.   TD3DRMIMAGE = record
  5681.     width, height: Integer;    (* width and height in pixels *)
  5682.     aspectx, aspecty: Integer; (* aspect ratio for non-square pixels *)
  5683.     depth: Integer;            (* bits per pixel *)
  5684.     rgb: Integer;              (* if false, pixels are indices into a
  5685.                                    palette otherwise, pixels encode
  5686.                                    RGB values. *)
  5687.     bytes_per_line: Integer;   (* number of bytes of memory for a
  5688.                                    scanline. This must be a multiple
  5689.                                    of 4. *)
  5690.     buffer1: Pointer;          (* memory to render into (first buffer). *)
  5691.     buffer2: Pointer;          (* second rendering buffer for double
  5692.                                    buffering, set to NULL for single
  5693.                                    buffering. *)
  5694.     red_mask: Longint;
  5695.     green_mask: Longint;
  5696.     blue_mask: Longint;
  5697.     alpha_mask: Longint;       (* if rgb is true, these are masks for
  5698.                                    the red, green and blue parts of a
  5699.                                    pixel.  Otherwise, these are masks
  5700.                                    for the significant bits of the
  5701.                                    red, green and blue elements in the
  5702.                                    palette.  For instance, most SVGA
  5703.                                    displays use 64 intensities of red,
  5704.                                    green and blue, so the masks should
  5705.                                    all be set to 0xfc. *)
  5706.     palette_size: Integer;     (* number of entries in palette *)
  5707.     palette: PD3DRMPALETTEENTRY; (* description of the palette (only if
  5708.                                    rgb is false).  Must be (1<<depth)
  5709.                                    elements. *)
  5710.   end;
  5711.   PD3DRMIMAGE = ^TD3DRMIMAGE;
  5712.  
  5713.   TD3DRMWRAPTYPE = ( D3DRMWRAP_FLAT, D3DRMWRAP_CYLINDER, D3DRMWRAP_SPHERE, D3DRMWRAP_CHROME );
  5714.   PD3DRMWRAPTYPE = ^TD3DRMWRAPTYPE;
  5715.  
  5716. const
  5717.   D3DRMWIREFRAME_CULL             = 1; (* cull backfaces *)
  5718.   D3DRMWIREFRAME_HIDDENLINE       = 2; (* lines are obscured by closer objects *)
  5719.  
  5720. type
  5721.   TD3DRMPROJECTIONTYPE = ( D3DRMPROJECT_PERSPECTIVE, D3DRMPROJECT_ORTHOGRAPHIC );
  5722.   PD3DRMPROJECTIONTYPE = ^TD3DRMPROJECTIONTYPE;
  5723.  
  5724.   TD3DRMXOFFORMAT = ( D3DRMXOF_BINARY, D3DRMXOF_COMPRESSED, D3DRMXOF_TEXT );
  5725.   PD3DRMXOFFORMAT = ^TD3DRMXOFFORMAT;
  5726.  
  5727.   TD3DRMSAVEOPTIONS = DWORD;
  5728.   PD3DRMSAVEOPTIONS = ^TD3DRMSAVEOPTIONS;
  5729.  
  5730. const
  5731.   D3DRMXOFSAVE_NORMALS = 1;
  5732.   D3DRMXOFSAVE_TEXTURECOORDINATES = 2;
  5733.   D3DRMXOFSAVE_MATERIALS = 4;
  5734.   D3DRMXOFSAVE_TEXTURENAMES = 8;
  5735.   D3DRMXOFSAVE_ALL = 15;
  5736.   D3DRMXOFSAVE_TEMPLATES = 16;
  5737.  
  5738. type
  5739.   TD3DRMCOLORSOURCE = ( D3DRMCOLOR_FROMFACE, D3DRMCOLOR_FROMVERTEX );
  5740.   PD3DRMCOLORSOURCE = ^TD3DRMCOLORSOURCE;
  5741.  
  5742.   TD3DRMFRAMECONSTRAINT = (
  5743.     D3DRMCONSTRAIN_Z,           (* use only X and Y rotations *)
  5744.     D3DRMCONSTRAIN_Y,           (* use only X and Z rotations *)
  5745.     D3DRMCONSTRAIN_X            (* use only Y and Z rotations *)
  5746.   );
  5747.   PD3DRMFRAMECONSTRAINT = ^TD3DRMFRAMECONSTRAINT;
  5748.  
  5749.   TD3DRMMATERIALMODE = ( D3DRMMATERIAL_FROMMESH, D3DRMMATERIAL_FROMPARENT,
  5750.       D3DRMMATERIAL_FROMFRAME );
  5751.   PD3DRMMATERIALMODE = ^TD3DRMMATERIALMODE;
  5752.  
  5753.   TD3DRMFOGMODE = (
  5754.     D3DRMFOG_LINEAR,            (* linear between start and end *)
  5755.     D3DRMFOG_EXPONENTIAL,       (* density * exp(-distance) *)
  5756.     D3DRMFOG_EXPONENTIALSQUARED (* density * exp(-distance*distance) *)
  5757.   );
  5758.   PD3DRMFOGMODE = ^TD3DRMFOGMODE;
  5759.  
  5760.   TD3DRMZBUFFERMODE = (
  5761.     D3DRMZBUFFER_FROMPARENT,    (* default *)
  5762.     D3DRMZBUFFER_ENABLE,        (* enable zbuffering *)
  5763.     D3DRMZBUFFER_DISABLE        (* disable zbuffering *)
  5764.   );
  5765.   PD3DRMZBUFFERMODE = ^TD3DRMZBUFFERMODE;
  5766.  
  5767.   TD3DRMSORTMODE = (
  5768.     D3DRMSORT_FROMPARENT,       (* default *)
  5769.     D3DRMSORT_NONE,             (* don't sort child frames *)
  5770.     D3DRMSORT_FRONTTOBACK,      (* sort child frames front-to-back *)
  5771.     D3DRMSORT_BACKTOFRONT       (* sort child frames back-to-front *)
  5772.   );
  5773.   PD3DRMSORTMODE = ^TD3DRMSORTMODE;
  5774.  
  5775.   TD3DRMANIMATIONOPTIONS = DWORD;
  5776.  
  5777. const
  5778.   D3DRMANIMATION_OPEN = $01;
  5779.   D3DRMANIMATION_CLOSED = $02;
  5780.   D3DRMANIMATION_LINEARPOSITION = $04;
  5781.   D3DRMANIMATION_SPLINEPOSITION = $08;
  5782.   D3DRMANIMATION_SCALEANDROTATION = $00000010;
  5783.   D3DRMANIMATION_POSITION = $00000020;
  5784.  
  5785. type
  5786.   TD3DRMLOADOPTIONS = DWORD;
  5787.  
  5788. const
  5789.   D3DRMLOAD_FROMFILE  = $00;
  5790.   D3DRMLOAD_FROMRESOURCE = $01;
  5791.   D3DRMLOAD_FROMMEMORY = $02;
  5792.   D3DRMLOAD_FROMSTREAM = $04;
  5793.  
  5794.   D3DRMLOAD_BYNAME = $10;
  5795.   D3DRMLOAD_BYPOSITION = $20;
  5796.   D3DRMLOAD_BYGUID = $40;
  5797.   D3DRMLOAD_FIRST = $80;
  5798.  
  5799.   D3DRMLOAD_INSTANCEBYREFERENCE = $100;
  5800.   D3DRMLOAD_INSTANCEBYCOPYING = $200;
  5801.  
  5802. type
  5803.   TD3DRMLOADRESOURCE = record
  5804.     hModule: HMODULE;
  5805.     lpName: PChar;
  5806.     lpType: PChar;
  5807.   end;
  5808.   PD3DRMLOADRESOURCE = ^TD3DRMLOADRESOURCE;
  5809.  
  5810.   TD3DRMLOADMEMORY = record
  5811.     lpMemory: Pointer;
  5812.     dSize: DWORD;
  5813.   end;
  5814.   PD3DRMLOADMEMORY = ^TD3DRMLOADMEMORY;
  5815.  
  5816.   TD3DRMUSERVISUALREASON = ( D3DRMUSERVISUAL_CANSEE, D3DRMUSERVISUAL_RENDER );
  5817.   PD3DRMUSERVISUALREASON = ^TD3DRMUSERVISUALREASON;
  5818.  
  5819.   TD3DRMMAPPING = DWORD;
  5820.   TD3DRMMAPPINGFLAG = DWORD;
  5821.   PD3DRMMAPPING = ^TD3DRMMAPPING;
  5822.  
  5823. const
  5824.   D3DRMMAP_WRAPU = 1;
  5825.   D3DRMMAP_WRAPV = 2;
  5826.   D3DRMMAP_PERSPCORRECT = 4;
  5827.  
  5828. type
  5829.   TD3DRMVERTEX = record
  5830.     position:TD3DVECTOR;
  5831.     normal:TD3DVECTOR;
  5832.     tu, tv:TD3DVALUE;
  5833.     color:TD3DCOLOR;
  5834.   end;
  5835.   PD3DRMVERTEX = ^TD3DRMVERTEX;
  5836.  
  5837.   TD3DRMGROUPINDEX = Longint; (* group indexes begin a 0 *)
  5838.  
  5839. const
  5840.   D3DRMGROUP_ALLGROUPS = -1;
  5841.  
  5842. function D3DRMCreateColorRGB (red, green, blue:TD3DVALUE):TD3DCOLOR; stdcall;
  5843. function D3DRMCreateColorRGBA (red, green, blue, alpha:TD3DVALUE):TD3DCOLOR; stdcall;
  5844. function D3DRMColorGetRed (d3drmc:TD3DCOLOR):TD3DVALUE;
  5845. function D3DRMColorGetGreen (d3drmc:TD3DCOLOR):TD3DVALUE;
  5846. function D3DRMColorGetBlue (d3drmc:TD3DCOLOR):TD3DVALUE;
  5847. function D3DRMColorGetAlpha (d3drmc:TD3DCOLOR):TD3DVALUE;
  5848. function D3DRMVectorAdd (var d, s1, s2:TD3DVECTOR): PD3DVECTOR; stdcall;
  5849. function D3DRMVectorSubtract (var d, s1, s2:TD3DVECTOR): PD3DVECTOR; stdcall;
  5850. function D3DRMVectorReflect (var d, ray, norm:TD3DVECTOR): PD3DVECTOR; stdcall;
  5851. function D3DRMVectorCrossProduct (var d, s1, s2:TD3DVECTOR): PD3DVECTOR; stdcall;
  5852. function D3DRMVectorDotProduct (var s1, s2:TD3DVECTOR):TD3DVALUE; stdcall;
  5853. function D3DRMVectorNormalize (var lpv:TD3DVECTOR): PD3DVECTOR; stdcall;
  5854. function D3DRMVectorNormalise (var lpv:TD3DVECTOR): PD3DVECTOR; stdcall;
  5855. function D3DRMVectorModulus (var v:TD3DVECTOR):TD3DVALUE; stdcall;
  5856. function D3DRMVectorRotate (var r, v, axis:TD3DVECTOR;
  5857.   theta:TD3DVALUE): PD3DVECTOR; stdcall;
  5858. function D3DRMVectorScale(var d, s:TD3DVECTOR;
  5859.   factor:TD3DVALUE): PD3DVECTOR; stdcall;
  5860. function D3DRMVectorRandom (var d:TD3DVECTOR): PD3DVECTOR; stdcall;
  5861. function D3DRMQuaternionFromRotation (var quat: TD3DRMQUATERNION;
  5862.     var v: TD3DVECTOR; theta:TD3DVALUE): PD3DRMQUATERNION; stdcall;
  5863. function D3DRMQuaternionMultiply (var q, a, b:TD3DRMQUATERNION): PD3DRMQUATERNION; stdcall;
  5864. function D3DRMQuaternionSlerp(var q, a, b:TD3DRMQUATERNION;
  5865.     alpha:TD3DVALUE): PD3DRMQUATERNION; stdcall;
  5866. procedure D3DRMMatrixFromQuaternion (dmMat:TD3DRMMATRIX4D;
  5867.     var lpDqQuat: TD3DRMQUATERNION); stdcall;
  5868.  
  5869.  
  5870. { from d3drmobj.h }
  5871. type
  5872.   IDirect3DRMObject = interface;
  5873.   IDirect3DRMDevice = interface;
  5874.   IDirect3DRMViewport = interface;
  5875.   IDirect3DRMFrame = interface;
  5876.   IDirect3DRMVisual = interface;
  5877.   IDirect3DRMMesh = interface;
  5878.   IDirect3DRMMeshBuilder = interface;
  5879.   IDirect3DRMFace = interface;
  5880.   IDirect3DRMLight = interface;
  5881.   IDirect3DRMTexture = interface;
  5882.   IDirect3DRMWrap = interface;
  5883.   IDirect3DRMMaterial = interface;
  5884.   IDirect3DRMAnimation = interface;
  5885.   IDirect3DRMAnimationSet = interface;
  5886.   IDirect3DRMUserVisual = interface;
  5887.   IDirect3DRMShadow = interface;
  5888.   IDirect3DRMArray = interface;
  5889.   IDirect3DRMDeviceArray = interface;
  5890.   IDirect3DRMFaceArray = interface;
  5891.   IDirect3DRMViewportArray = interface;
  5892.   IDirect3DRMFrameArray = interface;
  5893.   IDirect3DRMVisualArray = interface;
  5894.   IDirect3DRMPickedArray = interface;
  5895.   IDirect3DRMLightArray = interface;
  5896.  
  5897.   TD3DRMOBJECTCALLBACK = procedure (const  D3DRMobj: IDirect3DRMObject;
  5898.       lpArg: Pointer) stdcall;
  5899.   TD3DRMFRAMEMOVECALLBACK = procedure (const D3DRMFrame: IDirect3DRMFrame;
  5900.       lpArg: Pointer; delta: TD3DVALUE) stdcall;
  5901.   TD3DRMUPDATECALLBACK = procedure (const obj: IDirect3DRMDevice;
  5902.       lpArg: Pointer; iRectCount: Integer; d3dRectUpdate: PD3DRECT) stdcall;
  5903.   TD3DRMUSERVISUALCALLBACK = function (const D3DRMUV: IDirect3DRMUserVisual;
  5904.       lpArg: Pointer; D3DRMUVreason: TD3DRMUSERVISUALREASON;
  5905.       const D3DRMDev: IDirect3DRMDevice;
  5906.       const D3DRMview: IDirect3DRMViewport): Integer stdcall;
  5907.   TD3DRMLOADTEXTURECALLBACK = function (tex_name: PChar; lpArg: Pointer;
  5908.       const D3DRMTex: IDirect3DRMTexture): HRESULT stdcall;
  5909.   TD3DRMLOADCALLBACK = procedure (const Obj: IDirect3DRMObject;
  5910.       const ObjectGuid: TGUID; lpArg: Pointer) stdcall;
  5911.  
  5912.   PD3DRMPICKDESC = ^TD3DRMPICKDESC;
  5913.   TD3DRMPICKDESC = record
  5914.     ulFaceIdx: LongInt;
  5915.     lGroupIdx: LongInt;
  5916.     vPosition: TD3DVECTOR;
  5917.   end;
  5918.  
  5919.   IDirect3DRMObject = interface (IUnknown)
  5920.     ['{eb16cb00-d271-11ce-ac48-0000c03825a1}']
  5921.      function Clone (const pUnkOuter: IUnknown; const riid: TGUID;
  5922.         out ppvObj): HRESULT; stdcall;
  5923.      function AddDestroyCallback (lpCallback: TD3DRMOBJECTCALLBACK;
  5924.         lpArg: Pointer): HRESULT; stdcall;
  5925.      function DeleteDestroyCallback (d3drmObjProc: TD3DRMOBJECTCALLBACK;
  5926.         lpArg: Pointer): HRESULT; stdcall;
  5927.      function SetAppData (ulData: DWORD): HRESULT; stdcall;
  5928.      function GetAppData: DWORD; stdcall;
  5929.      function SetName (lpName: PChar): HRESULT; stdcall;
  5930.      function GetName (var lpdwSize: DWORD; lpName: PChar): HRESULT; stdcall;
  5931.      function GetClassName (var lpdwSize: DWORD; lpName: PChar): HRESULT;
  5932.         stdcall;
  5933.   end;
  5934.  
  5935.   IDirect3DRMVisual = interface (IDirect3DRMObject)
  5936.     ['{eb16cb04-d271-11ce-ac48-0000c03825a1}']
  5937.   end;
  5938.  
  5939.   IDirect3DRMDevice = interface (IDirect3DRMObject)
  5940.     ['{e9e19280-6e05-11cf-ac4a-0000c03825a1}']
  5941.     function Init (width: LongInt; height: LongInt): HRESULT;  stdcall;
  5942.     function InitFromD3D (const D3D: IDirect3D;
  5943.       const D3DIMDev: IDirect3DDevice): HRESULT; stdcall;
  5944.     function InitFromClipper (const DDClipper: IDirectDrawClipper;
  5945.       const GUID: TGUID; width: Integer; height: Integer): HRESULT; stdcall;
  5946.     function Update: HRESULT; stdcall;
  5947.     function AddUpdateCallback (d3drmUpdateProc: TD3DRMUPDATECALLBACK;
  5948.         arg: Pointer): HRESULT; stdcall;
  5949.     function DeleteUpdateCallback (d3drmUpdateProc: TD3DRMUPDATECALLBACK;
  5950.         arg: Pointer): HRESULT; stdcall;
  5951.     function SetBufferCount (dwCount: DWORD): HRESULT; stdcall;
  5952.     function GetBufferCount: DWORD; stdcall;
  5953.     function SetDither (bDither: BOOL): HRESULT; stdcall;
  5954.     function SetShades (ulShades: DWORD): HRESULT; stdcall;
  5955.     function SetQuality (rqQuality: TD3DRMRENDERQUALITY): HRESULT; stdcall;
  5956.     function SetTextureQuality (
  5957.         tqTextureQuality: TD3DRMTEXTUREQUALITY): HRESULT; stdcall;
  5958.     function GetViewports (out Viewports: IDirect3DRMViewportArray): HRESULT;
  5959.         stdcall;
  5960.     function GetDither: BOOL; stdcall;
  5961.     function GetShades: DWORD; stdcall;
  5962.     function GetHeight: DWORD; stdcall;
  5963.     function GetWidth: DWORD; stdcall;
  5964.     function GetTrianglesDrawn: DWORD; stdcall;
  5965.     function GetWireframeOptions: DWORD; stdcall;
  5966.     function GetQuality: TD3DRMRENDERQUALITY; stdcall;
  5967.     function GetColorModel: TD3DCOLORMODEL; stdcall;
  5968.     function GetTextureQuality: TD3DRMTEXTUREQUALITY; stdcall;
  5969.     function GetDirect3DDevice (out D3DDevice: IDirect3DDevice): HRESULT;
  5970.         stdcall;
  5971.   end;
  5972.  
  5973.   IDirect3DRMViewport = interface (IDirect3DRMObject)
  5974.     ['{eb16cb02-d271-11ce-ac48-0000c03825a1}']
  5975.     function Init (const D3DRMDevice: IDirect3DRMDevice;
  5976.         const D3DRMFrameCamera: IDirect3DRMFrame;
  5977.         xpos, ypos, width, height: DWORD): HRESULT; stdcall;
  5978.     function Clear: HRESULT; stdcall;
  5979.     function Render (const D3DRMFrame: IDirect3DRMFrame): HRESULT; stdcall;
  5980.     function SetFront (rvFront: TD3DVALUE): HRESULT; stdcall;
  5981.     function SetBack (rvBack: TD3DVALUE): HRESULT; stdcall;
  5982.     function SetField (rvField: TD3DVALUE): HRESULT; stdcall;
  5983.     function SetUniformScaling (bScale: BOOL): HRESULT; stdcall;
  5984.     function SetCamera (const Camera: IDirect3DRMFrame): HRESULT; stdcall;
  5985.     function SetProjection (rptType: TD3DRMPROJECTIONTYPE): HRESULT; stdcall;
  5986.     function Transform (var lprvDst: TD3DRMVECTOR4D;
  5987.         var lprvSrc: TD3DVECTOR): HRESULT; stdcall;
  5988.     function InverseTransform (var lprvDst: TD3DVECTOR;
  5989.         var lprvSrc: TD3DRMVECTOR4D): HRESULT; stdcall;
  5990.     function Configure (lX, lY: LongInt; dwWidth, dwHeight: DWORD): HRESULT;
  5991.         stdcall;
  5992.     function ForceUpdate (dwX1, dwY1, dwX2, dwY2: DWORD): HRESULT; stdcall;
  5993.     function SetPlane (rvLeft, rvRight, rvBottom, rvTop: TD3DVALUE): HRESULT;
  5994.         stdcall;
  5995.     function GetCamera (const Camera: IDirect3DRMFrame): HRESULT; stdcall;
  5996.     function GetDevice (const D3DRMDevice: IDirect3DRMDevice): HRESULT; stdcall;
  5997.     function GetPlane (var lpd3dvLeft, lpd3dvRight, lpd3dvBottom,
  5998.         lpd3dvTop: TD3DVALUE): HRESULT; stdcall;
  5999.     function Pick (lX, lY: LongInt;
  6000.         var lplpVisuals: IDirect3DRMPickedArray): HRESULT; stdcall;
  6001.     function GetUniformScaling: BOOL; stdcall;
  6002.     function GetX: LongInt; stdcall;
  6003.     function GetY: LongInt; stdcall;
  6004.     function GetWidth: DWORD; stdcall;
  6005.     function GetHeight: DWORD; stdcall;
  6006.     function GetField: TD3DVALUE; stdcall;
  6007.     function GetBack: TD3DVALUE; stdcall;
  6008.     function GetFront: TD3DVALUE; stdcall;
  6009.     function GetProjection: TD3DRMPROJECTIONTYPE; stdcall;
  6010.     function GetDirect3DViewport (var lplpD3DViewport: IDirect3DViewport):HRESULT;
  6011.         stdcall;
  6012.   end;
  6013.  
  6014.   IDirect3DRMFrame = interface (IDirect3DRMVisual)
  6015.     ['{eb16cb03-d271-11ce-ac48-0000c03825a1}']
  6016.     function AddChild (const D3DRMFrameChild: IDirect3DRMFrame): HRESULT; stdcall;
  6017.     function AddLight (const D3DRMLight: IDirect3DRMLight): HRESULT; stdcall;
  6018.     function AddMoveCallback (d3drmFMC: TD3DRMFRAMEMOVECALLBACK;
  6019.         lpArg: Pointer): HRESULT; stdcall;
  6020.     function AddTransform (rctCombine: TD3DRMCOMBINETYPE;
  6021.         rmMatrix: TD3DRMMATRIX4D): HRESULT; stdcall;
  6022.     function AddTranslation (rctCombine: TD3DRMCOMBINETYPE;
  6023.         rvX, rvY, rvZ: TD3DVALUE): HRESULT; stdcall;
  6024.     function AddScale (rctCombine: TD3DRMCOMBINETYPE;
  6025.         rvX, rvY, rvZ: TD3DVALUE): HRESULT; stdcall;
  6026.     function AddRotation (rctCombine: TD3DRMCOMBINETYPE;
  6027.         rvX, rvY, rvZ, rvTheta: TD3DVALUE): HRESULT; stdcall;
  6028.     function AddVisual (const D3DRMVisual: IDirect3DRMVisual): HRESULT; stdcall;
  6029.     function GetChildren (out Children: IDirect3DRMFrameArray): HRESULT;
  6030.         stdcall;
  6031.     function GetColor: TD3DCOLOR; stdcall;
  6032.     function GetLights (out Lights: IDirect3DRMLightArray): HRESULT; stdcall;
  6033.     function GetMaterialMode: TD3DRMMATERIALMODE; stdcall;
  6034.     function GetParent (out Parent: IDirect3DRMFrame): HRESULT; stdcall;
  6035.     function GetPosition (const Ref: IDirect3DRMFrame;
  6036.         var lprvPos: TD3DVECTOR): HRESULT; stdcall;
  6037.     function GetRotation (const Ref: IDirect3DRMFrame;
  6038.         var lprvAxis: TD3DVECTOR; var lprvTheta: TD3DVALUE): HRESULT; stdcall;
  6039.     function GetScene (out Root: IDirect3DRMFrame): HRESULT; stdcall;
  6040.     function GetSortMode: TD3DRMSORTMODE; stdcall;
  6041.     function GetTexture (out Texture: IDirect3DRMTexture): HRESULT; stdcall;
  6042.     function GetTransform (rmMatrix: TD3DRMMATRIX4D): HRESULT; stdcall;
  6043.     function GetVelocity (const Ref: IDirect3DRMFrame; var lprvVel: TD3DVECTOR;
  6044.         fRotVel: BOOL): HRESULT; stdcall;
  6045.     function GetOrientation (const Ref: IDirect3DRMFrame;
  6046.         var lprvDir, lprvUp: TD3DVECTOR): HRESULT; stdcall;
  6047.     function GetVisuals (out Visuals: IDirect3DRMVisualArray): HRESULT; stdcall;
  6048.     function GetTextureTopology (var lpU, lpV: BOOL): HRESULT; stdcall;
  6049.     function InverseTransform (var lprvDst, lprvSrc: TD3DVECTOR): HRESULT;
  6050.         stdcall;
  6051.     function Load (lpvObjSource, lpvObjID: Pointer;
  6052.         d3drmLOFlags: TD3DRMLOADOPTIONS;
  6053.         d3drmLoadTextureProc: TD3DRMLOADTEXTURECALLBACK;
  6054.         lpArgLTP: Pointer): HRESULT; stdcall;
  6055.     function LookAt (const Target, Ref: IDirect3DRMFrame;
  6056.         rfcConstraint: TD3DRMFRAMECONSTRAINT): HRESULT; stdcall;
  6057.     function Move (delta: TD3DVALUE): HRESULT; stdcall;
  6058.     function DeleteChild (const Child: IDirect3DRMFrame): HRESULT; stdcall;
  6059.     function DeleteLight (const D3DRMLight: IDirect3DRMLight): HRESULT; stdcall;
  6060.     function DeleteMoveCallback (d3drmFMC: TD3DRMFRAMEMOVECALLBACK;
  6061.         lpArg: Pointer): HRESULT; stdcall;
  6062.     function DeleteVisual (const D3DRMVisual: IDirect3DRMVisual): HRESULT;
  6063.         stdcall;
  6064.     function GetSceneBackground: TD3DCOLOR; stdcall;
  6065.     function GetSceneBackgroundDepth (
  6066.         out DDSurface: IDirectDrawSurface): HRESULT; stdcall;
  6067.     function GetSceneFogColor: TD3DCOLOR; stdcall;
  6068.     function GetSceneFogEnable: BOOL; stdcall;
  6069.     function GetSceneFogMode: TD3DRMFOGMODE; stdcall;
  6070.     function GetSceneFogParams (var lprvStart, lprvEnd,
  6071.         lprvDensity: TD3DVALUE): HRESULT; stdcall;
  6072.     function SetSceneBackground (rcColor: TD3DCOLOR): HRESULT; stdcall;
  6073.     function SetSceneBackgroundRGB (rvRed, rvGreen,
  6074.         rvBlue: TD3DVALUE): HRESULT; stdcall;
  6075.     function SetSceneBackgroundDepth (
  6076.         const Image: IDirectDrawSurface): HRESULT; stdcall;
  6077.     function SetSceneBackgroundImage (
  6078.         const Texture: IDirect3DRMTexture): HRESULT; stdcall;
  6079.     function SetSceneFogEnable (bEnable: BOOL): HRESULT; stdcall;
  6080.     function SetSceneFogColor (rcColor: TD3DCOLOR): HRESULT; stdcall;
  6081.     function SetSceneFogMode (rfMode: TD3DRMFOGMODE): HRESULT; stdcall;
  6082.     function SetSceneFogParams (rvStart, rvEnd, rvDensity: TD3DVALUE): HRESULT;
  6083.         stdcall;
  6084.     function SetColor (rcColor: TD3DCOLOR): HRESULT; stdcall;
  6085.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DVALUE): HRESULT; stdcall;
  6086.     function GetZbufferMode: TD3DRMZBUFFERMODE; stdcall;
  6087.     function SetMaterialMode (rmmMode: TD3DRMMATERIALMODE): HRESULT; stdcall;
  6088.     function SetOrientation (const Ref: IDirect3DRMFrame;
  6089.         rvDx, rvDy, rvDz, rvUx, rvUy, rvUz: TD3DVALUE): HRESULT; stdcall;
  6090.     function SetPosition (const Ref: IDirect3DRMFrame;
  6091.         rvX, rvY, rvZ: TD3DVALUE): HRESULT; stdcall;
  6092.     function SetRotation (const Ref: IDirect3DRMFrame; rvX, rvY, rvZ,
  6093.         rvTheta: TD3DVALUE): HRESULT; stdcall;
  6094.     function SetSortMode (d3drmSM: TD3DRMSORTMODE): HRESULT; stdcall;
  6095.     function SetTexture (const D3DRMTexture: IDirect3DRMTexture): HRESULT; stdcall;
  6096.     function SetTextureTopology (cylU, cylV: BOOL): HRESULT; stdcall;
  6097.     function SetVelocity (const Ref: IDirect3DRMFrame; rvX, rvY, rvZ: TD3DVALUE;
  6098.         fRotVel: BOOL): HRESULT; stdcall;
  6099.     function SetZbufferMode (d3drmZBM: TD3DRMZBUFFERMODE): HRESULT; stdcall;
  6100.     function Transform (var lpd3dVDst, lpd3dVSrc: TD3DVECTOR): HRESULT; stdcall;
  6101.   end;
  6102.  
  6103.   IDirect3DRMMesh = interface (IDirect3DRMVisual)
  6104.     ['{a3a80d01-6e12-11cf-ac4a-0000c03825a1}']
  6105.     function Scale (sx, sy, sz: TD3DVALUE): HRESULT; stdcall;
  6106.     function Translate (tx, ty, tz: TD3DVALUE): HRESULT; stdcall;
  6107.     function GetBox (var lpD3DRMBox: TD3DRMBOX): HRESULT; stdcall;
  6108.     function AddGroup (vCount, fCount, vPerFace: DWORD; var fData: DWORD;
  6109.         var returnId: TD3DRMGROUPINDEX): HRESULT; stdcall;
  6110.     function SetVertices (id: TD3DRMGROUPINDEX; index, count: DWORD;
  6111.         var values: TD3DRMVERTEX): HRESULT; stdcall;
  6112.     function SetGroupColor (id: TD3DRMGROUPINDEX; value: TD3DCOLOR): HRESULT;
  6113.         stdcall;
  6114.     function SetGroupColorRGB (id: TD3DRMGROUPINDEX; red, green,
  6115.         blue: TD3DVALUE): HRESULT; stdcall;
  6116.     function SetGroupMapping (id: TD3DRMGROUPINDEX;
  6117.         value: TD3DRMMAPPING): HRESULT; stdcall;
  6118.     function SetGroupQuality (id: TD3DRMGROUPINDEX;
  6119.         value: TD3DRMRENDERQUALITY): HRESULT; stdcall;
  6120.     function SetGroupMaterial (id: TD3DRMGROUPINDEX;
  6121.         const value: IDirect3DRMMaterial): HRESULT; stdcall;
  6122.     function SetGroupTexture (id: TD3DRMGROUPINDEX;
  6123.         const value: IDirect3DRMTexture): HRESULT; stdcall;
  6124.     function GetGroupCount: DWORD; stdcall;
  6125.     function GetGroup (id: TD3DRMGROUPINDEX; var vCount, fCount, vPerFace,
  6126.         fDataSize, fData: DWORD): HRESULT; stdcall;
  6127.     function GetVertices (id: TD3DRMGROUPINDEX; index, count: DWORD;
  6128.         returnPtr: PD3DRMVERTEX): HRESULT; stdcall;
  6129.     function GetGroupColor (id: TD3DRMGROUPINDEX): TD3DCOLOR; stdcall;
  6130.     function GetGroupMapping (id: TD3DRMGROUPINDEX): TD3DRMMAPPING; stdcall;
  6131.     function GetGroupQuality (id: TD3DRMGROUPINDEX): TD3DRMRENDERQUALITY; stdcall;
  6132.     function GetGroupMaterial (id: TD3DRMGROUPINDEX;
  6133.         out returnPtr: IDirect3DRMMaterial): HRESULT; stdcall;
  6134.     function GetGroupTexture (id: TD3DRMGROUPINDEX;
  6135.         out returnPtr: IDirect3DRMTexture): HRESULT; stdcall;
  6136.   end;
  6137.  
  6138.   IDirect3DRMShadow = interface (IDirect3DRMVisual)
  6139.     ['{af359780-6ba3-11cf-ac4a-0000c03825a1}']
  6140.     function Init (const D3DRMVisual: IDirect3DRMVisual;
  6141.         const D3DRMLight: IDirect3DRMLight;
  6142.         px, py, pz, nx, ny, nz: TD3DVALUE): HRESULT; stdcall;
  6143.   end;
  6144.  
  6145.   IDirect3DRMFace = interface (IDirect3DRMObject)
  6146.     ['{eb16cb07-d271-11ce-ac48-0000c03825a1}']
  6147.      function AddVertex (x, y, z: TD3DVALUE): HRESULT; stdcall;
  6148.      function AddVertexAndNormalIndexed (vertex, normal: DWORD): HRESULT; stdcall;
  6149.      function SetColorRGB (red, green, blue: TD3DVALUE): HRESULT; stdcall;
  6150.      function SetColor (color: TD3DCOLOR): HRESULT; stdcall;
  6151.      function SetTexture (const D3DRMTexture: IDirect3DRMTexture): HRESULT;
  6152.         stdcall;
  6153.      function SetTextureCoordinates (vertex: DWORD; u, v: TD3DVALUE): HRESULT;
  6154.         stdcall;
  6155.      function SetMaterial (const Mat: IDirect3DRMMaterial): HRESULT; stdcall;
  6156.      function SetTextureTopology (cylU, cylV: BOOL): HRESULT; stdcall;
  6157.      function GetVertex (index: DWORD; var lpPosition: TD3DVECTOR;
  6158.         var lpNormal: TD3DVECTOR): HRESULT; stdcall;
  6159.      function GetVertices (var lpdwVertexCount: DWORD;
  6160.         var lpPosition, lpNormal: TD3DVECTOR): HRESULT; stdcall;
  6161.      function GetTextureCoordinates (index: DWORD;
  6162.         var lpU, lpV: TD3DVALUE): HRESULT; stdcall;
  6163.      function GetTextureTopology (var lpU, lpV: BOOL): HRESULT; stdcall;
  6164.      function GetNormal (var lpNormal: TD3DVECTOR): HRESULT; stdcall;
  6165.      function GetTexture (out Texture: IDirect3DRMTexture): HRESULT; stdcall;
  6166.      function GetMaterial (const Mat: IDirect3DRMMaterial): HRESULT; stdcall;
  6167.      function GetVertexCount: Integer; stdcall;
  6168.      function GetVertexIndex (dwIndex: DWORD): Integer; stdcall;
  6169.      function GetTextureCoordinateIndex (dwIndex: DWORD): Integer; stdcall;
  6170.      function GetColor: TD3DCOLOR; stdcall;
  6171.   end;
  6172.  
  6173.   IDirect3DRMMeshBuilder = interface (IDirect3DRMVisual)
  6174.     ['{a3a80d02-6e12-11cf-ac4a-0000c03825a1}']
  6175.     function Load (lpvObjSource, lpvObjID: Pointer;
  6176.         d3drmLOFlags: TD3DRMLOADOPTIONS;
  6177.         d3drmLoadTextureProc: TD3DRMLOADTEXTURECALLBACK;
  6178.         lpvArg: Pointer): HRESULT; stdcall;
  6179.     function Save (lpFilename: PChar; d3drmXOFFormat: TD3DRMXOFFORMAT;
  6180.         d3drmSOContents: TD3DRMSAVEOPTIONS): HRESULT; stdcall;
  6181.     function Scale (sx, sy, sz: TD3DVALUE): HRESULT; stdcall;
  6182.     function Translate (tx, ty, tz: TD3DVALUE): HRESULT; stdcall;
  6183.     function SetColorSource (source: TD3DRMCOLORSOURCE): HRESULT; stdcall;
  6184.     function GetBox (var lpD3DRMBox: TD3DRMBOX): HRESULT; stdcall;
  6185.     function GenerateNormals: HRESULT; stdcall;
  6186.     function GetColorSource: TD3DRMCOLORSOURCE; stdcall;
  6187.     function AddMesh (const D3DRMMesh: IDirect3DRMMesh): HRESULT; stdcall;
  6188.     function AddMeshBuilder (
  6189.         const D3DRMMeshBuild: IDirect3DRMMeshBuilder): HRESULT; stdcall;
  6190.     function AddFrame (const D3DRMFrame: IDirect3DRMFrame): HRESULT; stdcall;
  6191.     function AddFace (const D3DRMFace: IDirect3DRMFace): HRESULT; stdcall;
  6192.     function AddFaces (dwVertexCount: DWORD; lpD3DVertices: Pointer;
  6193.         normalCount: DWORD; lpNormals: Pointer; lpFaceData: Pointer;
  6194.         out D3DRMFaceArray: IDirect3DRMFaceArray): HRESULT; stdcall;
  6195.     function ReserveSpace (vertexCount, normalCount,
  6196.         faceCount: DWORD): HRESULT; stdcall;
  6197.     function SetColorRGB (red, green, blue: TD3DVALUE): HRESULT; stdcall;
  6198.     function SetColor (color: TD3DCOLOR): HRESULT; stdcall;
  6199.     function SetTexture (const D3DRMTexture: IDirect3DRMTexture): HRESULT;
  6200.         stdcall;
  6201.     function SetMaterial (
  6202.         const IDirect3DRMmaterial: IDirect3DRMMaterial): HRESULT; stdcall;
  6203.     function SetTextureTopology (cylU, cylV: BOOL): HRESULT; stdcall;
  6204.     function SetQuality (quality: TD3DRMRENDERQUALITY): HRESULT; stdcall;
  6205.     function SetPerspective (perspective: BOOL): HRESULT; stdcall;
  6206.     function SetVertex (index: DWORD; x, y, z: TD3DVALUE): HRESULT; stdcall;
  6207.     function SetNormal (index: DWORD; x, y, z: TD3DVALUE): HRESULT; stdcall;
  6208.     function SetTextureCoordinates (index: DWORD; u, v: TD3DVALUE): HRESULT;
  6209.         stdcall;
  6210.     function SetVertexColor (index: DWORD; color: TD3DCOLOR): HRESULT; stdcall;
  6211.     function SetVertexColorRGB (index: DWORD; red, green,
  6212.         blue: TD3DVALUE): HRESULT; stdcall;
  6213.     function GetFaces (out D3DRMFaceArray: IDirect3DRMFaceArray): HRESULT;
  6214.         stdcall;
  6215.     function GetVertices(var VertexCount: DWORD; Vertices: Pointer;
  6216.       var NormalsCount: DWORD; Normals: Pointer;
  6217.       var FaceDataSize: DWORD; face_data: Pointer): HRESULT; stdcall;
  6218.     function AddVertex (x, y, z: TD3DVALUE): Integer; stdcall;
  6219.     function AddNormal (x, y, z: TD3DVALUE): Integer; stdcall;
  6220.     function CreateFace (out d3drmFace: IDirect3DRMFace): HRESULT; stdcall;
  6221.     function GetQuality: TD3DRMRENDERQUALITY; stdcall;
  6222.     function GetPerspective: BOOL; stdcall;
  6223.     function GetFaceCount: Integer; stdcall;
  6224.     function GetVertexCount: Integer; stdcall;
  6225.     function GetVertexColor (index: DWORD): TD3DCOLOR; stdcall;
  6226.     function CreateMesh (out D3DRMMesh: IDirect3DRMMesh): HRESULT; stdcall;
  6227.   end;
  6228.  
  6229.   IDirect3DRMLight = interface (IDirect3DRMObject)
  6230.     ['{eb16cb08-d271-11ce-ac48-0000c03825a1}']
  6231.     function SetType (d3drmtType: TD3DRMLIGHTTYPE): HRESULT; stdcall;
  6232.     function SetColor (rcColor: TD3DCOLOR): HRESULT; stdcall;
  6233.     function SetColorRGB (rvRed, rvGreen, rvBlue: TD3DVALUE): HRESULT; stdcall;
  6234.     function SetRange (rvRange: TD3DVALUE): HRESULT; stdcall;
  6235.     function SetUmbra (rvAngle: TD3DVALUE): HRESULT; stdcall;
  6236.     function SetPenumbra (rvAngle: TD3DVALUE): HRESULT; stdcall;
  6237.     function SetConstantAttenuation (rvAtt: TD3DVALUE): HRESULT; stdcall;
  6238.     function SetLinearAttenuation (rvAtt: TD3DVALUE): HRESULT; stdcall;
  6239.     function SetQuadraticAttenuation (rvAtt: TD3DVALUE): HRESULT; stdcall;
  6240.     function GetRange: TD3DVALUE; stdcall;
  6241.     function GetUmbra: TD3DVALUE; stdcall;
  6242.     function GetPenumbra: TD3DVALUE; stdcall;
  6243.     function GetConstantAttenuation: TD3DVALUE; stdcall;
  6244.     function GetLinearAttenuation: TD3DVALUE; stdcall;
  6245.     function GetQuadraticAttenuation: TD3DVALUE; stdcall;
  6246.     function GetColor: TD3DCOLOR; stdcall;
  6247.     function GetType: TD3DRMLIGHTTYPE; stdcall;
  6248.     function SetEnableFrame (const EnableFrame: IDirect3DRMFrame): HRESULT;
  6249.         stdcall;
  6250.     function GetEnableFrame (out EnableFrame: IDirect3DRMFrame): HRESULT;
  6251.         stdcall;
  6252.   end;
  6253.  
  6254.   IDirect3DRMTexture = interface (IDirect3DRMVisual)
  6255.     ['{eb16cb09-d271-11ce-ac48-0000c03825a1}']
  6256.     function InitFromFile (Filename: PChar): HRESULT; stdcall;
  6257.     function InitFromSurface (const DDS: IDirectDrawSurface): HRESULT; stdcall;
  6258.     function InitFromResource (rs: HRSRC): HRESULT; stdcall;
  6259.     function Changed (bPixels, bPalette: BOOL): HRESULT; stdcall;
  6260.     function SetColors (ulColors: DWORD): HRESULT; stdcall;
  6261.     function SetShades (ulShades: DWORD): HRESULT; stdcall;
  6262.     function SetDecalSize (rvWidth, rvHeight: TD3DVALUE): HRESULT; stdcall;
  6263.     function SetDecalOrigin (lX, lY: LongInt): HRESULT; stdcall;
  6264.     function SetDecalScale (dwScale: DWORD): HRESULT; stdcall;
  6265.     function SetDecalTransparency (bTransp: BOOL): HRESULT; stdcall;
  6266.     function SetDecalTransparentColor (rcTransp: TD3DCOLOR): HRESULT; stdcall;
  6267.     function GetDecalSize (var lprvWidth, lprvHeight: TD3DVALUE): HRESULT;
  6268.         stdcall;
  6269.     function GetDecalOrigin (var lplX, lplY: LongInt): HRESULT; stdcall;
  6270.     function GetImage: PD3DRMIMAGE; stdcall;
  6271.     function GetShades: DWORD; stdcall;
  6272.     function GetColors: DWORD; stdcall;
  6273.     function GetDecalScale: DWORD; stdcall;
  6274.     function GetDecalTransparency: BOOL; stdcall;
  6275.     function GetDecalTransparentColor: TD3DCOLOR; stdcall;
  6276.   end;
  6277.  
  6278.   IDirect3DRMWrap = interface (IDirect3DRMObject)
  6279.     ['{eb16cb0a-d271-11ce-ac48-0000c03825a1}']
  6280.     function Init (d3drmwt: TD3DRMWRAPTYPE; const d3drmfRef: IDirect3DRMFrame;
  6281.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DVALUE): HRESULT;
  6282.         stdcall;
  6283.     function Apply (const Obj: IDirect3DRMObject): HRESULT; stdcall;
  6284.     function ApplyRelative (const frame: IDirect3DRMFrame;
  6285.         const mesh: IDirect3DRMObject): HRESULT; stdcall;
  6286.   end;
  6287.  
  6288.   IDirect3DRMMaterial = interface (IDirect3DRMObject)
  6289.     ['{eb16cb0b-d271-11ce-ac48-0000c03825a1}']
  6290.     function SetPower (rvPower: TD3DVALUE): HRESULT; stdcall;
  6291.     function SetSpecular (r, g, b: TD3DVALUE): HRESULT; stdcall;
  6292.     function SetEmissive (r, g, b: TD3DVALUE): HRESULT; stdcall;
  6293.     function GetPower: TD3DVALUE; stdcall;
  6294.     function GetSpecular (var lpr, lpg, lpb: TD3DVALUE): HRESULT; stdcall;
  6295.     function GetEmissive (var lpr, lpg, lpb: TD3DVALUE): HRESULT; stdcall;
  6296.   end;
  6297.  
  6298.   IDirect3DRMAnimation = interface (IDirect3DRMObject)
  6299.     ['{eb16cb0d-d271-11ce-ac48-0000c03825a1}']
  6300.     function SetOptions (d3drmanimFlags: TD3DRMANIMATIONOPTIONS): HRESULT;
  6301.         stdcall;
  6302.     function AddRotateKey (rvTime: TD3DVALUE;
  6303.         var rqQuat: TD3DRMQUATERNION): HRESULT; stdcall;
  6304.     function AddPositionKey (rvTime, rvX, rvY, rvZ: TD3DVALUE): HRESULT;
  6305.         stdcall;
  6306.     function AddScaleKey (time, x, y, z: TD3DVALUE): HRESULT; stdcall;
  6307.     function DeleteKey (time: TD3DVALUE): HRESULT; stdcall;
  6308.     function SetFrame (const D3DRMFrame: IDirect3DRMFrame): HRESULT; stdcall;
  6309.     function SetTime (rvTime: TD3DVALUE): HRESULT; stdcall;
  6310.     function GetOptions: TD3DRMANIMATIONOPTIONS; stdcall;
  6311.   end;
  6312.  
  6313.   IDirect3DRMAnimationSet = interface (IDirect3DRMObject)
  6314.     ['{eb16cb0e-d271-11ce-ac48-0000c03825a1}']
  6315.     function AddAnimation (const D3DRMAnimation: IDirect3DRMAnimation): HRESULT;
  6316.         stdcall;
  6317.     function Load (lpvObjSource, lpvObjID: Pointer;
  6318.         d3drmLOFlags: TD3DRMLOADOPTIONS;
  6319.         d3drmLoadTextureProc: TD3DRMLOADTEXTURECALLBACK; lpArgLTP: Pointer;
  6320.         lpParentFrame: IDirect3DRMFrame): HRESULT; stdcall;
  6321.     function DeleteAnimation (
  6322.         const D3DRMAnimation: IDirect3DRMAnimation): HRESULT; stdcall;
  6323.     function SetTime (rvTime: TD3DVALUE): HRESULT; stdcall;
  6324.  
  6325.   end;
  6326.  
  6327.   IDirect3DRMUserVisual = interface (IDirect3DRMVisual)
  6328.     ['{59163de0-6d43-11cf-ac4a-0000c03825a1}']
  6329.     function Init (d3drmUVProc: TD3DRMUSERVISUALCALLBACK;
  6330.         lpArg: Pointer): HRESULT; stdcall;
  6331.   end;
  6332.  
  6333.   IDirect3DRMArray = interface (IUnknown)
  6334.     function GetSize: DWORD; stdcall;
  6335.   end;
  6336.  
  6337.   IDirect3DRMDeviceArray = interface (IDirect3DRMArray)
  6338.     ['{eb16cb10-d271-11ce-ac48-0000c03825a1}']
  6339.     function GetElement (index: DWORD;
  6340.       out D3DRMDevice: IDirect3DRMDevice): HRESULT; stdcall;
  6341.   end;
  6342.  
  6343.   IDirect3DRMFrameArray = interface (IDirect3DRMArray)
  6344.     ['{eb16cb12-d271-11ce-ac48-0000c03825a1}']
  6345.     function GetElement (index: DWORD;
  6346.         out D3DRMFrame: IDirect3DRMFrame): HRESULT; stdcall;
  6347.   end;
  6348.  
  6349.   IDirect3DRMViewportArray = interface (IDirect3DRMArray)
  6350.     ['{eb16cb11-d271-11ce-ac48-0000c03825a1}']
  6351.     function GetElement (index: DWORD;
  6352.         out D3DRMViewport: IDirect3DRMViewport): HRESULT; stdcall;
  6353.   end;
  6354.  
  6355.   IDirect3DRMVisualArray = interface (IDirect3DRMArray)
  6356.     ['{eb16cb13-d271-11ce-ac48-0000c03825a1}']
  6357.     function GetElement (index: DWORD;
  6358.         out D3DRMVisual: IDirect3DRMVisual): HRESULT; stdcall;
  6359.   end;
  6360.  
  6361.   IDirect3DRMPickedArray = interface (IDirect3DRMArray)
  6362.     function GetPick (index: DWORD; out Visual: IDirect3DRMVisual;
  6363.         out FrameArray: IDirect3DRMFrameArray;
  6364.         var lpD3DRMPickDesc: TD3DRMPICKDESC): HRESULT; stdcall;
  6365.   end;
  6366.  
  6367.   IDirect3DRMLightArray = interface (IDirect3DRMArray)
  6368.     ['{eb16cb14-d271-11ce-ac48-0000c03825a1}']
  6369.     function GetElement (index: DWORD;
  6370.         out D3DRMLight: IDirect3DRMLight): HRESULT; stdcall;
  6371.   end;
  6372.  
  6373.   IDirect3DRMFaceArray = interface (IDirect3DRMArray)
  6374.     ['{eb16cb17-d271-11ce-ac48-0000c03825a1}']
  6375.     function GetElement (index: DWORD;
  6376.         out D3DRMFace: IDirect3DRMFace): HRESULT; stdcall;
  6377.   end;
  6378.  
  6379.  
  6380. { Direct3D Retained Mode interface }
  6381. { from d3drm.h }
  6382.  
  6383. type
  6384.   TD3DRMDEVICEPALETTECALLBACK = procedure(lpDirect3DRMDev: IDirect3DRMDevice;
  6385.       lpArg: Pointer; dwIndex: DWORD; red, green, blue: LongInt); stdcall;
  6386.  
  6387. type
  6388.   IDirect3DRM = interface(IUnknown)
  6389.     ['{2bc49361-8327-11cf-ac4a-0000c03825a1}']
  6390.     function CreateObject(const clsid: TGUID; const pUnkOuter: IUnknown;
  6391.         const riid: TGUID; out ppv: IUnknown): HRESULT; stdcall;
  6392.     function CreateFrame(const InFrame: IDirect3DRMFrame;
  6393.         out OutFrame: IDirect3DRMFrame): HRESULT; stdcall;
  6394.     function CreateMesh(out D3DRMMesh: IDirect3DRMMesh): HRESULT; stdcall;
  6395.     function CreateMeshBuilder(
  6396.         out D3DRMMeshBuilder: IDirect3DRMMeshBuilder): HRESULT; stdcall;
  6397.     function CreateFace(
  6398.         out D3drmFace: IDirect3DRMFace): HRESULT; stdcall;
  6399.     function CreateAnimation(
  6400.         out D3DRMAnimation: IDirect3DRMAnimation): HRESULT; stdcall;
  6401.     function CreateAnimationSet(
  6402.         out D3DRMAnimationSet: IDirect3DRMAnimationSet): HRESULT; stdcall;
  6403.     function CreateTexture(const lpImage: TD3DRMIMAGE;
  6404.         out D3DRMTexture: IDirect3DRMTexture): HRESULT; stdcall;
  6405.     function CreateLight(d3drmltLightType: TD3DRMLIGHTTYPE;
  6406.         cColor: TD3DCOLOR; out D3DRMLight: IDirect3DRMLight): HRESULT;
  6407.         stdcall;
  6408.     function CreateLightRGB(ltLightType: TD3DRMLIGHTTYPE;
  6409.         vRed, vGreen, vBlue: TD3DVALUE;
  6410.         out D3DRMLight: IDirect3DRMLight): HRESULT; stdcall;
  6411.     function CreateMaterial(vPower: TD3DVALUE;
  6412.         out D3DRMMaterial: IDirect3DRMMaterial): HRESULT; stdcall;
  6413.     function CreateDevice(dwWidth, dwHeight: DWORD;
  6414.         out D3DRMDevice: IDirect3DRMDevice): HRESULT; stdcall;
  6415.     (* Create a Windows Device using DirectDraw surfaces *)
  6416.     function CreateDeviceFromSurface(const GUID: TGUID; const DD: IDirectDraw;
  6417.         const DDSBack: IDirectDrawSurface;
  6418.         out D3DRMDevice: IDirect3DRMDevice): HRESULT; stdcall;
  6419.     (* Create a Windows Device using D3D objects *)
  6420.     function CreateDeviceFromD3D(const D3D: IDirect3D;
  6421.         const D3DDev: IDirect3DDevice;
  6422.         out D3DRMDevice: IDirect3DRMDevice): HRESULT; stdcall;
  6423.     function CreateDeviceFromClipper(const DDClipper: IDirectDrawClipper;
  6424.         const GUID: PGUID; width, height: Integer;
  6425.         out D3DRMDevice: IDirect3DRMDevice): HRESULT; stdcall;
  6426.     function CreateTextureFromSurface(const DDS: IDirectDrawSurface;
  6427.         out D3DRMTexture: IDirect3DRMTexture): HRESULT; stdcall;
  6428.     function CreateShadow(const Visual: IDirect3DRMVisual;
  6429.         const Light: IDirect3DRMLight; px, py, pz, nx, ny, nz: TD3DVALUE;
  6430.         out Shadow: IDirect3DRMVisual): HRESULT; stdcall;
  6431.     function CreateViewport(const Dev: IDirect3DRMDevice;
  6432.         const Camera: IDirect3DRMFrame;
  6433.         dwXPos, dwYPos, dwWidth, dwHeight: DWORD;
  6434.         out D3DRMViewport: IDirect3DRMViewport): HRESULT; stdcall;
  6435.     function CreateWrap(wraptype: TD3DRMWRAPTYPE; const Ref: IDirect3DRMFrame;
  6436.         ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv: TD3DVALUE;
  6437.         out D3DRMWrap: IDirect3DRMWrap): HRESULT; stdcall;
  6438.     function CreateUserVisual(fn: TD3DRMUSERVISUALCALLBACK; lpArg: Pointer;
  6439.         out D3DRMUV: IDirect3DRMUserVisual): HRESULT; stdcall;
  6440.     function LoadTexture(FileName: PChar;
  6441.         out D3DRMTexture: IDirect3DRMTexture): HRESULT; stdcall;
  6442.     function LoadTextureFromResource(rs: HRSRC;
  6443.         out D3DRMTexture: IDirect3DRMTexture): HRESULT; stdcall;
  6444.     function SetSearchPath(Path: PChar): HRESULT; stdcall;
  6445.     function AddSearchPath(Path: PChar): HRESULT; stdcall;
  6446.     function GetSearchPath(var lpdwSize: DWORD; lpszPath: PChar): HRESULT;
  6447.         stdcall;
  6448.     function SetDefaultTextureColors(dwColors: DWORD): HRESULT; stdcall;
  6449.     function SetDefaultTextureShades(dwShades: DWORD): HRESULT; stdcall;
  6450.     function GetDevices(out DevArray: IDirect3DRMDeviceArray): HRESULT;
  6451.         stdcall;
  6452.     function GetNamedObject(Name: PChar;
  6453.         out D3DRMObject: IDirect3DRMObject): HRESULT; stdcall;
  6454.     function EnumerateObjects(func: TD3DRMOBJECTCALLBACK;
  6455.         lpArg: Pointer): HRESULT; stdcall;
  6456.     function Load(lpvObjSource, lpvObjID, lplpGUIDs: Pointer;
  6457.         dwcGUIDs: DWORD; d3drmLOFlags: TD3DRMLOADOPTIONS;
  6458.         d3drmLoadProc: TD3DRMLOADCALLBACK; lpArgLP: Pointer;
  6459.         d3drmLoadTextureProc: TD3DRMLOADTEXTURECALLBACK; lpArgLTP: Pointer;
  6460.         const ParentFrame: IDirect3DRMFrame): HRESULT; stdcall;
  6461.     function Tick(d3dvalTick: TD3DVALUE): HRESULT; stdcall;
  6462.   end;
  6463.  
  6464. const
  6465.   D3DRM_OK                        = DD_OK;
  6466.   D3DRMERR_BADOBJECT              = $88760000 + 781;
  6467.   D3DRMERR_BADTYPE                = $88760000 + 782;
  6468.   D3DRMERR_BADALLOC               = $88760000 + 783;
  6469.   D3DRMERR_FACEUSED               = $88760000 + 784;
  6470.   D3DRMERR_NOTFOUND               = $88760000 + 785;
  6471.   D3DRMERR_NOTDONEYET             = $88760000 + 786;
  6472.   D3DRMERR_FILENOTFOUND           = $88760000 + 787;
  6473.   D3DRMERR_BADFILE                = $88760000 + 788;
  6474.   D3DRMERR_BADDEVICE              = $88760000 + 789;
  6475.   D3DRMERR_BADVALUE               = $88760000 + 790;
  6476.   D3DRMERR_BADMAJORVERSION        = $88760000 + 791;
  6477.   D3DRMERR_BADMINORVERSION        = $88760000 + 792;
  6478.   D3DRMERR_UNABLETOEXECUTE        = $88760000 + 793;
  6479.  
  6480. (* Create a Direct3DRM API *)
  6481. function Direct3DRMCreate(out Direct3DRM: IDirect3DRM): HRESULT; stdcall;
  6482.  
  6483.  
  6484. { from d3drmwin.h }
  6485.  
  6486. type
  6487.   IDirect3DRMWinDevice = interface ( IDirect3DRMObject )
  6488.     ['{c5016cc0-d273-11ce-ac48-0000c03825a1}']
  6489.     function HandlePaint ( hDC: HDC ): HRESULT ; stdcall ;
  6490.     function HandleActivate ( wparam: WORD ): HRESULT ; stdcall ;
  6491.   end ;
  6492.  
  6493.  
  6494. {------------- Direct Sound -------------------}
  6495. type
  6496.   IDirectSound = interface;
  6497.   IDirectSoundBuffer = interface;
  6498.   IDirectSound3DListener = interface;
  6499.   IDirectSound3DBuffer = interface;
  6500.  
  6501.   TDSCAPS = record
  6502.     dwSize: DWORD;
  6503.     dwFlags: DWORD;
  6504.     dwMinSecondarySampleRate: DWORD;
  6505.     dwMaxSecondarySampleRate: DWORD;
  6506.     dwPrimaryBuffers: DWORD;
  6507.     dwMaxHwMixingAllBuffers: DWORD;
  6508.     dwMaxHwMixingStaticBuffers: DWORD;
  6509.     dwMaxHwMixingStreamingBuffers: DWORD;
  6510.     dwFreeHwMixingAllBuffers: DWORD;
  6511.     dwFreeHwMixingStaticBuffers: DWORD;
  6512.     dwFreeHwMixingStreamingBuffers: DWORD;
  6513.     dwMaxHw3DAllBuffers: DWORD;
  6514.     dwMaxHw3DStaticBuffers: DWORD;
  6515.     dwMaxHw3DStreamingBuffers: DWORD;
  6516.     dwFreeHw3DAllBuffers: DWORD;
  6517.     dwFreeHw3DStaticBuffers: DWORD;
  6518.     dwFreeHw3DStreamingBuffers: DWORD;
  6519.     dwTotalHwMemBytes: DWORD;
  6520.     dwFreeHwMemBytes: DWORD;
  6521.     dwMaxContigFreeHwMemBytes: DWORD;
  6522.     dwUnlockTransferRateHwBuffers: DWORD;
  6523.     dwPlayCpuOverheadSwBuffers: DWORD;
  6524.     dwReserved1: DWORD;
  6525.     dwReserved2: DWORD;
  6526.   end;
  6527.   PDSCAPS = ^TDSCAPS;
  6528.  
  6529.   TDSBCAPS = record
  6530.     dwSize: DWORD;
  6531.     dwFlags: DWORD;
  6532.     dwBufferBytes: DWORD;
  6533.     dwUnlockTransferRate: DWORD;
  6534.     dwPlayCpuOverhead: DWORD;
  6535.   end;
  6536.   PDSBCAPS = ^TDSBCAPS;
  6537.  
  6538.   TDSBUFFERDESC = record
  6539.     dwSize: DWORD;
  6540.     dwFlags: DWORD;
  6541.     dwBufferBytes: DWORD;
  6542.     dwReserved: DWORD;
  6543.     lpwfxFormat: PWaveFormatEx;
  6544.   end;
  6545.   PDSBUFFERDESC = ^TDSBUFFERDESC;
  6546.  
  6547.   TDS3DBUFFER = packed record
  6548.     dwSize: DWORD;
  6549.     vPosition: TD3DVECTOR;
  6550.     vVelocity: TD3DVECTOR;
  6551.     dwInsideConeAngle: DWORD;
  6552.     dwOutsideConeAngle: DWORD;
  6553.     vConeOrientation: TD3DVECTOR;
  6554.     lConeOutsideVolume: longint;
  6555.     flMinDistance: TD3DVALUE;
  6556.     flMaxDistance: TD3DVALUE;
  6557.     dwMode: DWORD;
  6558.   end;
  6559.   PDS3DBUFFER = ^TDS3DBUFFER;
  6560.  
  6561.   TDS3DLISTENER = packed record
  6562.     dwSize: DWORD;
  6563.     vPosition: TD3DVECTOR;
  6564.     vVelocity: TD3DVECTOR;
  6565.     vOrientFront: TD3DVECTOR;
  6566.     vOrientTop: TD3DVECTOR;
  6567.     flDistanceFactor: TD3DVALUE;
  6568.     flRolloffFactor: TD3DVALUE;
  6569.     flDopplerFactor: TD3DVALUE;
  6570.   end;
  6571.   PDS3DLISTENER = ^TDS3DLISTENER;
  6572.  
  6573. //
  6574. // IDirectSound
  6575. //
  6576.  
  6577.   IDirectSound = interface (IUnknown)
  6578.     ['{279AFA83-4981-11CE-A521-0020AF0BE560}']
  6579.     function CreateSoundBuffer (const lpDSBufferDesc: TDSBUFFERDESC;
  6580.         out lplpDirectSoundBuffer: IDirectSoundBuffer;
  6581.         pUnkOuter: IUnknown): HRESULT; stdcall;
  6582.     function GetCaps (var lpDSCaps: TDSCAPS): HRESULT; stdcall;
  6583.     function DuplicateSoundBuffer (const lpDsbOriginal: IDirectSoundBuffer;
  6584.          out lplpDsbDuplicate: IDirectSoundBuffer): HRESULT; stdcall;
  6585.     function SetCooperativeLevel (hWnd: HWND; dwFlags: DWORD): HRESULT; stdcall;
  6586.     function Compact: HRESULT; stdcall;
  6587.     function GetSpeakerConfig (var lpdwSpeakerConfig: DWORD): HRESULT; stdcall;
  6588.     function SetSpeakerConfig (dwSpeakerConfig: DWORD): HRESULT; stdcall;
  6589.     function Initialize (const IID: TGUID): HRESULT; stdcall;
  6590.   end;
  6591.  
  6592. //
  6593. // IDirectSoundBuffer
  6594. //
  6595.  
  6596.   IDirectSoundBuffer = interface (IUnknown)
  6597.     ['{279AFA85-4981-11CE-A521-0020AF0BE560}']
  6598.     function GetCaps (var lpDSBufferCaps: TDSBCAPS): HRESULT; stdcall;
  6599.     function GetCurrentPosition (var dwCurrentPlayCursor: DWORD;
  6600.         var lpdwCurrentWriteCursor: DWORD): HRESULT; stdcall;
  6601.     function GetFormat (var lpwfxFormat: TWaveFormatEx;
  6602.         dwSizeAllocated: DWORD; var lpdwSizeWritten: DWORD): HRESULT; stdcall;
  6603.     function GetVolume (var lplVolume: LongInt): HRESULT; stdcall;
  6604.     function GetPan (var lplPan: LongInt): HRESULT; stdcall;
  6605.     function GetFrequency (var lpdwFrequency: DWORD): HRESULT; stdcall;
  6606.     function GetStatus (var lpdwStatus: DWORD): HRESULT; stdcall;
  6607.     function Initialize (const lpDirectSound: IDirectSound;
  6608.         const lpDSBufferDesc: TDSBUFFERDESC ): HRESULT; stdcall;
  6609.     function Lock (dwWriteCursor: DWORD; dwWriteBytes: DWORD;
  6610.         var lplpvAudioPtr1: Pointer; var lpdwAudioBytes1: DWORD;
  6611.         var lplpvAudioPtr2: Pointer; var lpdwAudioBytes2: DWORD;
  6612.         dwFlags: DWORD): HRESULT; stdcall;
  6613.     function Play (dwReserved1, dwReserved2, dwFlags: DWORD): HRESULT; stdcall;
  6614.     function SetCurrentPosition (dwNewPosition: DWORD): HRESULT; stdcall;
  6615.     function SetFormat (const lpfxFormat: TWaveFormatEx): HRESULT; stdcall;
  6616.     function SetVolume (lVolume: LongInt): HRESULT; stdcall;
  6617.     function SetPan (lPan: LongInt): HRESULT; stdcall;
  6618.     function SetFrequency (dwFrequency: DWORD): HRESULT; stdcall;
  6619.     function Stop: HRESULT; stdcall;
  6620.     function Unlock (lpvAudioPtr1: Pointer; dwAudioBytes1: DWORD;
  6621.         lpvAudioPtr2: Pointer; dwAudioBytes2: DWORD): HRESULT; stdcall;
  6622.     function Restore: HRESULT; stdcall;
  6623.   end;
  6624.  
  6625. //
  6626. // IDirectSound3DListener
  6627. //
  6628.  
  6629.   IDirectSound3DListener = interface (IUnknown)
  6630.     ['{279AFA84-4981-11CE-A521-0020AF0BE560}']
  6631.     function GetAllParameters (var lpListener: TDS3DLISTENER): HRESULT; stdcall;
  6632.     function GetDistanceFactor (var lpflDistanceFactor: TD3DVALUE): HRESULT; stdcall;
  6633.     function GetDopplerFactor (var lpflDopplerFactor: TD3DVALUE): HRESULT; stdcall;
  6634.     function GetOrientation (var lpvOrientFront: TD3DVECTOR;
  6635.         var lpvOrientTop: TD3DVECTOR): HRESULT; stdcall;
  6636.     function GetPosition (var lpvPosition: TD3DVECTOR): HRESULT; stdcall;
  6637.     function GetRolloffFactor (var lpflRolloffFactor: TD3DVALUE): HRESULT; stdcall;
  6638.     function GetVelocity (var lpvVelocity: TD3DVECTOR): HRESULT; stdcall;
  6639.     function SetAllParameters (const lpListener: TDS3DLISTENER;
  6640.         dwApply: DWORD): HRESULT; stdcall;
  6641.     function SetDistanceFactor (flDistanceFactor: TD3DVALUE;
  6642.         dwApply: DWORD): HRESULT; stdcall;
  6643.     function SetDopplerFactor (flDopplerFactor: TD3DVALUE;
  6644.         dwApply: DWORD): HRESULT; stdcall;
  6645.     function SetOrientation (xFront, yFront, zFront, xTop, yTop, zTop: TD3DVALUE;
  6646.         dwApply: DWORD): HRESULT; stdcall;
  6647.     function SetPosition (x, y, z: TD3DVALUE; dwApply: DWORD): HRESULT; stdcall;
  6648.     function SetRolloffFactor (flRolloffFactor: TD3DVALUE;
  6649.         dwApply: DWORD): HRESULT; stdcall;
  6650.     function SetVelocity (x, y, z: TD3DVALUE; dwApply: DWORD): HRESULT; stdcall;
  6651.     function CommitDeferredSettings: HRESULT; stdcall;
  6652.   end;
  6653.  
  6654. //
  6655. // IDirectSound3DBuffer
  6656. //
  6657.  
  6658.   IDirectSound3DBuffer = interface (IUnknown)
  6659.     ['{279AFA86-4981-11CE-A521-0020AF0BE560}']
  6660.     function GetAllParameters (var lpDs3dBuffer: TDS3DBUFFER): HRESULT; stdcall;
  6661.     function GetConeAngles (var lpdwInsideConeAngle: DWORD;
  6662.         var lpdwOutsideConeAngle: DWORD): HRESULT; stdcall;
  6663.     function GetConeOrientation (var lpvOrientation: TD3DVECTOR): HRESULT; stdcall;
  6664.     function GetConeOutsideVolume (var lplConeOutsideVolume: longint): HRESULT; stdcall;
  6665.     function GetMaxDistance (var lpflMaxDistance: TD3DVALUE): HRESULT; stdcall;
  6666.     function GetMinDistance (var lpflMinDistance: TD3DVALUE): HRESULT; stdcall;
  6667.     function GetMode (var lpdwMode: DWORD): HRESULT; stdcall;
  6668.     function GetPosition (var lpvPosition: TD3DVECTOR): HRESULT; stdcall;
  6669.     function GetVelocity (var lpvVelocity: TD3DVECTOR): HRESULT; stdcall;
  6670.     function SetAllParameters (const lpDs3dBuffer: TDS3DBUFFER;
  6671.         dwApply: DWORD): HRESULT; stdcall;
  6672.     function SetConeAngles (dwInsideConeAngle, dwOutsideConeAngle,
  6673.         dwApply: DWORD): HRESULT; stdcall;
  6674.     function SetConeOrientation (x, y, z: TD3DVALUE;
  6675.         dwApply: DWORD): HRESULT; stdcall;
  6676.     function SetConeOutsideVolume (lConeOutsideVolume: longint;
  6677.         dwApply: DWORD): HRESULT; stdcall;
  6678.     function SetMaxDistance (flMaxDistance: TD3DVALUE;
  6679.         dwApply: DWORD): HRESULT; stdcall;
  6680.     function SetMinDistance (flMinDistance: TD3DVALUE;
  6681.         dwApply: DWORD): HRESULT; stdcall;
  6682.     function SetMode (dwMode: DWORD; dwApply: DWORD): HRESULT; stdcall;
  6683.     function SetPosition (x, y, z: TD3DVALUE; dwApply: DWORD): HRESULT; stdcall;
  6684.     function SetVelocity (x, y, z: TD3DVALUE; dwApply: DWORD): HRESULT; stdcall;
  6685.   end;
  6686.  
  6687. (*
  6688.  * Return Codes
  6689.  *)
  6690.  
  6691. const
  6692.   DS_OK                           = 0;
  6693.  
  6694. (*
  6695.  * The call failed because resources (such as a priority level)
  6696.  *  were already being used by another caller.
  6697.  *)
  6698.   DSERR_ALLOCATED                 = $88780000 + 10;
  6699. (*
  6700.  * The control (vol,pan,etc.) requested by the caller is not available.
  6701.  *)
  6702.   DSERR_CONTROLUNAVAIL            = $88780000 + 30;
  6703. (*
  6704.  * An invalid parameter was passed to the returning function
  6705.  *)
  6706.   DSERR_INVALIDPARAM              = E_INVALIDARG;
  6707. (*
  6708.  * This call is not valid for the current state of this object
  6709.  *)
  6710.   DSERR_INVALIDCALL               = $88780000 + 50;
  6711. (*
  6712.  * An undetermined error occured inside the DSound subsystem
  6713.  *)
  6714.   DSERR_GENERIC                   = E_FAIL;
  6715. (*
  6716.  * The caller does not have the priority level required for the function to
  6717.  * succeed.
  6718.  *)
  6719.   DSERR_PRIOLEVELNEEDED           = $88780000 + 70;
  6720. (*
  6721.  * The DSound subsystem couldn't allocate sufficient memory to complete the
  6722.  * caller's request.
  6723.  *)
  6724.   DSERR_OUTOFMEMORY               = E_OUTOFMEMORY;
  6725. (*
  6726.  * The specified WAVE format is not supported
  6727.  *)
  6728.   DSERR_BADFORMAT                 = $88780000 + 100;
  6729. (*
  6730.  * The function called is not supported at this time
  6731.  *)
  6732.   DSERR_UNSUPPORTED               = E_NOTIMPL;
  6733. (*
  6734.  * No sound driver is available for use
  6735.  *)
  6736.   DSERR_NODRIVER                  = $88780000 + 120;
  6737. (*
  6738.  * This object is already initialized
  6739.  *)
  6740.   DSERR_ALREADYINITIALIZED        = $88780000 + 130;
  6741. (*
  6742.  * This object does not support aggregation
  6743.  *)
  6744.   DSERR_NOAGGREGATION             = CLASS_E_NOAGGREGATION;
  6745. (*
  6746.  * The buffer memory has been lost, and must be Restored.
  6747.  *)
  6748.   DSERR_BUFFERLOST                = $88780000 + 150;
  6749. (*
  6750.  * Another app has a higher priority level, preventing this call from
  6751.  * succeeding.
  6752.  *)
  6753.   DSERR_OTHERAPPHASPRIO           = $88780000 + 160;
  6754. (*
  6755.  * The Initialize() member on the Direct Sound Object has not been
  6756.  * called or called successfully before calls to other members.
  6757.  *)
  6758.   DSERR_UNINITIALIZED             = $88780000 + 170;
  6759.  
  6760. //==========================================================================;
  6761. //
  6762. //                               Flags...
  6763. //
  6764. //==========================================================================;
  6765.  
  6766.   DSCAPS_PRIMARYMONO          = $00000001;
  6767.   DSCAPS_PRIMARYSTEREO        = $00000002;
  6768.   DSCAPS_PRIMARY8BIT          = $00000004;
  6769.   DSCAPS_PRIMARY16BIT         = $00000008;
  6770.   DSCAPS_CONTINUOUSRATE       = $00000010;
  6771.   DSCAPS_EMULDRIVER           = $00000020;
  6772.   DSCAPS_CERTIFIED            = $00000040;
  6773.   DSCAPS_SECONDARYMONO        = $00000100;
  6774.   DSCAPS_SECONDARYSTEREO      = $00000200;
  6775.   DSCAPS_SECONDARY8BIT        = $00000400;
  6776.   DSCAPS_SECONDARY16BIT       = $00000800;
  6777.  
  6778.   DSBPLAY_LOOPING             = $00000001;
  6779.  
  6780.   DSBSTATUS_PLAYING           = $00000001;
  6781.   DSBSTATUS_BUFFERLOST        = $00000002;
  6782.   DSBSTATUS_LOOPING           = $00000004;
  6783.  
  6784.   DSBLOCK_FROMWRITECURSOR     = $00000001;
  6785.  
  6786.   DSSCL_NORMAL                = 1;
  6787.   DSSCL_PRIORITY              = 2;
  6788.   DSSCL_EXCLUSIVE             = 3;
  6789.   DSSCL_WRITEPRIMARY          = 4;
  6790.  
  6791. // flags for IDirectSound3DBuffer::SetMode
  6792.   DS3DMODE_NORMAL             = 0;      // default must be 0
  6793.   DS3DMODE_HEADRELATIVE       = 1;
  6794.   DS3DMODE_DISABLE            = 2;
  6795.  
  6796. // flags for dwApply parameter of some 3D functions
  6797.   DS3D_IMMEDIATE              = 0;
  6798.   DS3D_DEFERRED               = 1;
  6799.  
  6800. // default values for 3d factors
  6801.   DS3D_DEFAULTDISTANCEFACTOR  = 1.0;
  6802.   DS3D_DEFAULTROLLOFFFACTOR   = 1.0;
  6803.   DS3D_DEFAULTDOPPLERFACTOR   = 1.0;
  6804.  
  6805.   DSBCAPS_PRIMARYBUFFER       = $00000001;
  6806.   DSBCAPS_STATIC              = $00000002;
  6807.   DSBCAPS_LOCHARDWARE         = $00000004;
  6808.   DSBCAPS_LOCSOFTWARE         = $00000008;
  6809.   DSBCAPS_CTRL3D              = $00000010;
  6810.   DSBCAPS_CTRLFREQUENCY       = $00000020;
  6811.   DSBCAPS_CTRLPAN             = $00000040;
  6812.   DSBCAPS_CTRLVOLUME          = $00000080;
  6813.   DSBCAPS_CTRLDEFAULT         = $000000E0;  // Pan + volume + frequency.
  6814.   DSBCAPS_CTRLALL             = $000000F0;  // All control capabilities
  6815.   DSBCAPS_STICKYFOCUS         = $00004000;
  6816.   DSBCAPS_GLOBALFOCUS         = $00008000;
  6817.   DSBCAPS_GETCURRENTPOSITION2 = $00010000;  // More accurate play cursor under emulation
  6818.  
  6819.   DSSPEAKER_HEADPHONE         = 1;
  6820.   DSSPEAKER_MONO              = 2;
  6821.   DSSPEAKER_QUAD              = 3;
  6822.   DSSPEAKER_STEREO            = 4;
  6823.   DSSPEAKER_SURROUND          = 5;
  6824.  
  6825. type
  6826.   TDSENUMCALLBACK = function (const lpGuid: TGUID; Description, Module: PChar;
  6827.     lpContext: Pointer): BOOL; stdcall;
  6828.  
  6829. function DirectSoundCreate (SoundDevice: PGUID; out DS: IDirectSound;
  6830.     pUnkOuter: IUnknown): HRESULT; stdcall;
  6831. function DirectSoundEnumerate (Callback: TDSENUMCALLBACK;
  6832.     lpContext: Pointer): HRESULT; stdcall;
  6833.  
  6834. const
  6835.   D3DRM = 'D3DRM.DLL';
  6836.  
  6837. implementation
  6838.  
  6839. function DirectDrawEnumerate; external 'DDRAW.DLL' name 'DirectDrawEnumerateA';
  6840. function DirectDrawCreate; external 'DDRAW.DLL';
  6841. function DirectDrawCreateClipper; external 'DDRAW.DLL';
  6842. function NtDirectDrawCreate; external 'DDRAW.DLL';
  6843.  
  6844. function DirectPlayEnumerate; external 'DPLAYX.DLL' name 'DirectPlayEnumerateA';
  6845. function DirectPlayCreate; external 'DPLAYX.DLL';
  6846.  
  6847. function DirectSoundEnumerate; external 'DSOUND.DLL' name 'DirectSoundEnumerateA';
  6848. function DirectSoundCreate; external 'DSOUND.DLL';
  6849.  
  6850. function Direct3DRMCreate; external D3DRM;
  6851. function D3DRMCreateColorRGB ; external D3DRM;
  6852. function D3DRMCreateColorRGBA ; external D3DRM;
  6853. function D3DRMColorGetRed ; external D3DRM;
  6854. function D3DRMColorGetGreen ; external D3DRM;
  6855. function D3DRMColorGetBlue ; external D3DRM;
  6856. function D3DRMColorGetAlpha ; external D3DRM;
  6857. function D3DRMVectorAdd ; external D3DRM;
  6858. function D3DRMVectorSubtract ; external D3DRM;
  6859. function D3DRMVectorReflect ; external D3DRM;
  6860. function D3DRMVectorCrossProduct ; external D3DRM;
  6861. function D3DRMVectorDotProduct ; external D3DRM;
  6862. function D3DRMVectorNormalize ; external D3DRM;
  6863. function D3DRMVectorNormalise ; external D3DRM name 'D3DRMVectorNormalize' ;
  6864. function D3DRMVectorModulus ; external D3DRM;
  6865. function D3DRMVectorRotate ; external D3DRM;
  6866. function D3DRMVectorScale ; external D3DRM;
  6867. function D3DRMVectorRandom ; external D3DRM;
  6868. function D3DRMQuaternionFromRotation ; external D3DRM;
  6869. function D3DRMQuaternionMultiply ; external D3DRM;
  6870. function D3DRMQuaternionSlerp ; external D3DRM;
  6871. procedure D3DRMMatrixFromQuaternion ; external D3DRM;
  6872.  
  6873. end.
  6874.  
  6875.